1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

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>
This commit is contained in:
Thomas Heijligen 2021-05-04 15:32:17 +02:00 committed by Nico Huber
parent 085db626fb
commit 4f5169df5f
41 changed files with 506 additions and 617 deletions

View File

@ -31,7 +31,7 @@
static uint32_t io_base_addr = 0; static uint32_t io_base_addr = 0;
const struct dev_entry ata_hpt[] = { static const struct dev_entry ata_hpt[] = {
{0x1103, 0x0004, NT, "Highpoint", "HPT366/368/370/370A/372/372N"}, {0x1103, 0x0004, NT, "Highpoint", "HPT366/368/370/370A/372/372N"},
{0x1103, 0x0005, NT, "Highpoint", "HPT372A/372N"}, {0x1103, 0x0005, NT, "Highpoint", "HPT372A/372N"},
{0x1103, 0x0006, NT, "Highpoint", "HPT302/302N"}, {0x1103, 0x0006, NT, "Highpoint", "HPT302/302N"},
@ -64,7 +64,7 @@ static const struct par_master par_master_atahpt = {
.chip_writen = fallback_chip_writen, .chip_writen = fallback_chip_writen,
}; };
int atahpt_init(void) static int atahpt_init(void)
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
uint32_t reg32; uint32_t reg32;
@ -90,6 +90,16 @@ int atahpt_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_atahpt = {
.name = "atahpt",
.type = PCI,
.devs.dev = ata_hpt,
.init = atahpt_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#else #else
#error PCI port I/O access is not supported on this architecture yet. #error PCI port I/O access is not supported on this architecture yet.
#endif #endif

View File

@ -46,14 +46,14 @@ static uint32_t rom_base_addr = 0;
static uint8_t *atapromise_bar = NULL; static uint8_t *atapromise_bar = NULL;
static size_t rom_size = 0; static size_t rom_size = 0;
const struct dev_entry ata_promise[] = { static const struct dev_entry ata_promise[] = {
{0x105a, 0x4d38, NT, "Promise", "PDC20262 (FastTrak66/Ultra66)"}, {0x105a, 0x4d38, NT, "Promise", "PDC20262 (FastTrak66/Ultra66)"},
{0x105a, 0x0d30, NT, "Promise", "PDC20265 (FastTrak100 Lite/Ultra100)"}, {0x105a, 0x0d30, NT, "Promise", "PDC20265 (FastTrak100 Lite/Ultra100)"},
{0x105a, 0x4d30, OK, "Promise", "PDC20267 (FastTrak100/Ultra100)"}, {0x105a, 0x4d30, OK, "Promise", "PDC20267 (FastTrak100/Ultra100)"},
{0}, {0},
}; };
void *atapromise_map(const char *descr, uintptr_t phys_addr, size_t len) static void *atapromise_map(const char *descr, uintptr_t phys_addr, size_t len)
{ {
/* In case fallback_map ever returns something other than NULL. */ /* In case fallback_map ever returns something other than NULL. */
return NULL; return NULL;
@ -118,7 +118,7 @@ static const struct par_master par_master_atapromise = {
.chip_writen = fallback_chip_writen, .chip_writen = fallback_chip_writen,
}; };
int atapromise_init(void) static int atapromise_init(void)
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
@ -162,6 +162,16 @@ int atapromise_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_atapromise = {
.name = "atapromise",
.type = PCI,
.devs.dev = ata_promise,
.init = atapromise_init,
.map_flash_region = atapromise_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#else #else
#error PCI port I/O access is not supported on this architecture yet. #error PCI port I/O access is not supported on this architecture yet.
#endif #endif

View File

@ -48,7 +48,7 @@
#define ENABLE_BYTE(address) ((~(1 << ((address) & 3))) & BROM_BYTE_ENABLE_MASK) #define ENABLE_BYTE(address) ((~(1 << ((address) & 3))) & BROM_BYTE_ENABLE_MASK)
#define BYTE_OFFSET(address) (((addr) & 3) * 8) #define BYTE_OFFSET(address) (((addr) & 3) * 8)
const struct dev_entry ata_via[] = { static const struct dev_entry ata_via[] = {
{PCI_VENDOR_ID_VIA, 0x3249, DEP, "VIA", "VT6421A"}, {PCI_VENDOR_ID_VIA, 0x3249, DEP, "VIA", "VT6421A"},
{0}, {0},
@ -101,7 +101,7 @@ static bool atavia_ready(struct pci_dev *pcidev_dev)
return ready; return ready;
} }
void *atavia_map(const char *descr, uintptr_t phys_addr, size_t len) static void *atavia_map(const char *descr, uintptr_t phys_addr, size_t len)
{ {
return (atavia_offset != 0) ? atavia_offset : (void *)phys_addr; return (atavia_offset != 0) ? atavia_offset : (void *)phys_addr;
} }
@ -143,7 +143,7 @@ static const struct par_master lpc_master_atavia = {
.chip_writen = fallback_chip_writen, .chip_writen = fallback_chip_writen,
}; };
int atavia_init(void) static int atavia_init(void)
{ {
char *arg = extract_programmer_param("offset"); char *arg = extract_programmer_param("offset");
if (arg) { if (arg) {
@ -188,3 +188,13 @@ int atavia_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_atavia = {
.name = "atavia",
.type = PCI,
.devs.dev = ata_via,
.init = atavia_init,
.map_flash_region = atavia_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -302,7 +302,7 @@ static int buspirate_spi_send_command_v2(const struct flashctx *flash, unsigned
*/ */
#define BP_DIVISOR(baud) ((4000000/(baud)) - 1) #define BP_DIVISOR(baud) ((4000000/(baud)) - 1)
int buspirate_spi_init(void) static int buspirate_spi_init(void)
{ {
char *tmp; char *tmp;
char *dev; char *dev;
@ -659,3 +659,14 @@ int buspirate_spi_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_buspirate_spi = {
.name = "buspirate_spi",
.type = OTHER,
/* FIXME */
.devs.note = "Dangerous Prototypes Bus Pirate\n",
.init = buspirate_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -84,7 +84,7 @@ static unsigned int stored_delay_us = 0;
static struct libusb_device_handle *handle = NULL; 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"}, {0x1A86, 0x5512, OK, "Winchiphead (WCH)", "CH341A"},
{0}, {0},
@ -323,7 +323,7 @@ static void pluck_cs(uint8_t *ptr)
*ptr++ = CH341A_CMD_UIO_STM_END; *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 /* 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 * 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; return 0;
} }
int ch341a_spi_init(void) static int ch341a_spi_init(void)
{ {
if (handle != NULL) { if (handle != NULL) {
msg_cerr("%s: handle already set! Please report a bug at flashrom@flashrom.org\n", __func__); msg_cerr("%s: handle already set! Please report a bug at flashrom@flashrom.org\n", __func__);
@ -526,3 +526,13 @@ close_handle:
handle = NULL; handle = NULL;
return -1; 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,
};

View File

@ -152,7 +152,7 @@ enum protocol {
PROTOCOL_V3, PROTOCOL_V3,
}; };
const struct dev_entry devs_dediprog[] = { static const struct dev_entry devs_dediprog[] = {
{0x0483, 0xDADA, OK, "Dediprog", "SF100/SF200/SF600"}, {0x0483, 0xDADA, OK, "Dediprog", "SF100/SF200/SF600"},
{0}, {0},
@ -1055,7 +1055,7 @@ static int dediprog_shutdown(void *data)
return 0; return 0;
} }
int dediprog_init(void) static int dediprog_init(void)
{ {
char *voltage, *id_str, *device, *spispeed, *target_str; char *voltage, *id_str, *device, *spispeed, *target_str;
int spispeed_idx = 1; int spispeed_idx = 1;
@ -1279,3 +1279,13 @@ int dediprog_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_dediprog = {
.name = "dediprog",
.type = USB,
.devs.dev = devs_dediprog,
.init = dediprog_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -55,7 +55,7 @@
#define CP210X_WRITE_LATCH 0x37e1 #define CP210X_WRITE_LATCH 0x37e1
#define CP210X_READ_LATCH 0x00c2 #define CP210X_READ_LATCH 0x00c2
const struct dev_entry devs_developerbox_spi[] = { static const struct dev_entry devs_developerbox_spi[] = {
{0x10c4, 0xea60, OK, "Silicon Labs", "CP2102N USB to UART Bridge Controller"}, {0x10c4, 0xea60, OK, "Silicon Labs", "CP2102N USB to UART Bridge Controller"},
{0}, {0},
}; };
@ -144,7 +144,7 @@ static int developerbox_spi_shutdown(void *spi_data)
return 0; return 0;
} }
int developerbox_spi_init(void) static int developerbox_spi_init(void)
{ {
struct libusb_context *usb_ctx; struct libusb_context *usb_ctx;
libusb_device_handle *cp210x_handle; libusb_device_handle *cp210x_handle;
@ -190,3 +190,13 @@ err_exit:
libusb_exit(usb_ctx); libusb_exit(usb_ctx);
return 1; return 1;
} }
const struct programmer_entry programmer_developerbox = {
.name = "developerbox",
.type = USB,
.devs.dev = devs_developerbox_spi,
.init = developerbox_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -53,7 +53,7 @@ struct digilent_spi_data {
#define DIGILENT_VID 0x1443 #define DIGILENT_VID 0x1443
#define DIGILENT_JTAG_PID 0x0007 #define DIGILENT_JTAG_PID 0x0007
const struct dev_entry devs_digilent_spi[] = { static const struct dev_entry devs_digilent_spi[] = {
{ DIGILENT_VID, DIGILENT_JTAG_PID, OK, "Digilent", "Development board JTAG" }, { DIGILENT_VID, DIGILENT_JTAG_PID, OK, "Digilent", "Development board JTAG" },
{ 0 }, { 0 },
}; };
@ -373,7 +373,7 @@ static const struct digilent_spispeeds spispeeds[] = {
{ NULL, 0 }, { NULL, 0 },
}; };
int digilent_spi_init(void) static int digilent_spi_init(void)
{ {
char *p; char *p;
uint32_t speed_hz = spispeeds[0].speed; uint32_t speed_hz = spispeeds[0].speed;
@ -464,3 +464,13 @@ close_handle:
libusb_close(handle); libusb_close(handle);
return -1; return -1;
} }
const struct programmer_entry programmer_digilent_spi = {
.name = "digilent_spi",
.type = USB,
.devs.dev = devs_digilent_spi,
.init = digilent_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -29,7 +29,7 @@
/* Mask to restrict flash accesses to the 128kB memory window. */ /* Mask to restrict flash accesses to the 128kB memory window. */
#define DRKAISER_MEMMAP_MASK ((1 << 17) - 1) #define DRKAISER_MEMMAP_MASK ((1 << 17) - 1)
const struct dev_entry drkaiser_pcidev[] = { static const struct dev_entry drkaiser_pcidev[] = {
{0x1803, 0x5057, OK, "Dr. Kaiser", "PC-Waechter (Actel FPGA)"}, {0x1803, 0x5057, OK, "Dr. Kaiser", "PC-Waechter (Actel FPGA)"},
{0}, {0},
@ -60,7 +60,7 @@ static const struct par_master par_master_drkaiser = {
.chip_writen = fallback_chip_writen, .chip_writen = fallback_chip_writen,
}; };
int drkaiser_init(void) static int drkaiser_init(void)
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
uint32_t addr; uint32_t addr;
@ -89,3 +89,13 @@ int drkaiser_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_drkaiser = {
.name = "drkaiser",
.type = PCI,
.devs.dev = drkaiser_pcidev,
.init = drkaiser_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -89,14 +89,14 @@ static const uint8_t sfdp_table[] = {
0xFF, 0xFF, 0xFF, 0xFF, // @0x54: Macronix parameter table end 0xFF, 0xFF, 0xFF, 0xFF, // @0x54: Macronix parameter table end
}; };
void *dummy_map(const char *descr, uintptr_t phys_addr, size_t len) static void *dummy_map(const char *descr, uintptr_t phys_addr, size_t len)
{ {
msg_pspew("%s: Mapping %s, 0x%zx bytes at 0x%0*" PRIxPTR "\n", msg_pspew("%s: Mapping %s, 0x%zx bytes at 0x%0*" PRIxPTR "\n",
__func__, descr, len, PRIxPTR_WIDTH, phys_addr); __func__, descr, len, PRIxPTR_WIDTH, phys_addr);
return (void *)phys_addr; return (void *)phys_addr;
} }
void dummy_unmap(void *virt_addr, size_t len) static void dummy_unmap(void *virt_addr, size_t len)
{ {
msg_pspew("%s: Unmapping 0x%zx bytes at %p\n", __func__, len, virt_addr); msg_pspew("%s: Unmapping 0x%zx bytes at %p\n", __func__, len, virt_addr);
} }
@ -943,7 +943,7 @@ static int init_data(struct emu_data *data, enum chipbustype *dummy_buses_suppor
return 0; return 0;
} }
int dummy_init(void) static int dummy_init(void)
{ {
struct stat image_stat; struct stat image_stat;
@ -1060,3 +1060,14 @@ int probe_variable_size(struct flashctx *flash)
return 1; return 1;
} }
const struct programmer_entry programmer_dummy = {
.name = "dummy",
.type = OTHER,
/* FIXME */
.devs.note = "Dummy device, does nothing and logs all accesses\n",
.init = dummy_init,
.map_flash_region = dummy_map,
.unmap_flash_region = dummy_unmap,
.delay = internal_delay,
};

View File

@ -526,7 +526,7 @@ static int check_params(void)
return ret; return ret;
} }
int ene_lpc_init() static int ene_lpc_init()
{ {
uint8_t hwver, ediid, i; uint8_t hwver, ediid, i;
ene_lpc_data_t *ctx_data = NULL; ene_lpc_data_t *ctx_data = NULL;
@ -585,4 +585,14 @@ init_err_exit:
return 1; return 1;
} }
const struct programmer_entry programmer_ene_lpc = {
.name = "ene_lpc",
.type = OTHER,
.devs.note = "ENE LPC interface keyboard controller\n",
.init = ene_lpc_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif /* __i386__ || __x86_64__ */ #endif /* __i386__ || __x86_64__ */

View File

@ -59,7 +59,7 @@
#define GOOGLE_SERVO_V2_PID0 0x5002 #define GOOGLE_SERVO_V2_PID0 0x5002
#define GOOGLE_SERVO_V2_PID1 0x5003 #define GOOGLE_SERVO_V2_PID1 0x5003
const struct dev_entry devs_ft2232spi[] = { static const struct dev_entry devs_ft2232spi[] = {
{FTDI_VID, FTDI_FT2232H_PID, OK, "FTDI", "FT2232H"}, {FTDI_VID, FTDI_FT2232H_PID, OK, "FTDI", "FT2232H"},
{FTDI_VID, FTDI_FT4232H_PID, OK, "FTDI", "FT4232H"}, {FTDI_VID, FTDI_FT4232H_PID, OK, "FTDI", "FT4232H"},
{FTDI_VID, FTDI_FT232H_PID, OK, "FTDI", "FT232H"}, {FTDI_VID, FTDI_FT232H_PID, OK, "FTDI", "FT232H"},
@ -288,7 +288,7 @@ static const struct spi_master spi_master_ft2232 = {
}; };
/* Returns 0 upon success, a negative number upon errors. */ /* Returns 0 upon success, a negative number upon errors. */
int ft2232_spi_init(void) static int ft2232_spi_init(void)
{ {
int ret = 0; int ret = 0;
unsigned char buf[512]; unsigned char buf[512];
@ -636,4 +636,13 @@ ftdi_err:
return ret; return ret;
} }
const struct programmer_entry programmer_ft2232_spi = {
.name = "ft2232_spi",
.type = USB,
.devs.dev = devs_ft2232spi,
.init = ft2232_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif #endif

View File

@ -30,7 +30,7 @@
static uint8_t *nvidia_bar; static uint8_t *nvidia_bar;
const struct dev_entry gfx_nvidia[] = { static const struct dev_entry gfx_nvidia[] = {
{0x10de, 0x0010, NT, "NVIDIA", "Mutara V08 [NV2]" }, {0x10de, 0x0010, NT, "NVIDIA", "Mutara V08 [NV2]" },
{0x10de, 0x0018, NT, "NVIDIA", "RIVA 128" }, {0x10de, 0x0018, NT, "NVIDIA", "RIVA 128" },
{0x10de, 0x0020, NT, "NVIDIA", "RIVA TNT" }, {0x10de, 0x0020, NT, "NVIDIA", "RIVA TNT" },
@ -81,7 +81,7 @@ static const struct par_master par_master_gfxnvidia = {
.chip_writen = fallback_chip_writen, .chip_writen = fallback_chip_writen,
}; };
int gfxnvidia_init(void) static int gfxnvidia_init(void)
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
uint32_t reg32; uint32_t reg32;
@ -115,3 +115,13 @@ int gfxnvidia_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_gfxnvidia = {
.name = "gfxnvidia",
.type = PCI,
.devs.dev = gfx_nvidia,
.init = gfxnvidia_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -170,7 +170,7 @@ static const struct par_master par_master_internal = {
.chip_writen = fallback_chip_writen, .chip_writen = fallback_chip_writen,
}; };
int internal_init(void) static int internal_init(void)
{ {
int ret = 0; int ret = 0;
int force_laptop = 0; int force_laptop = 0;
@ -372,3 +372,13 @@ internal_init_exit:
return ret; return ret;
} }
const struct programmer_entry programmer_internal = {
.name = "internal",
.type = OTHER,
.devs.note = NULL,
.init = internal_init,
.map_flash_region = physmap,
.unmap_flash_region = physunmap,
.delay = internal_delay,
};

View File

@ -23,7 +23,7 @@ static uint8_t *it8212_bar = NULL;
#define PCI_VENDOR_ID_ITE 0x1283 #define PCI_VENDOR_ID_ITE 0x1283
const struct dev_entry devs_it8212[] = { static const struct dev_entry devs_it8212[] = {
{PCI_VENDOR_ID_ITE, 0x8212, NT, "ITE", "8212F PATA RAID"}, {PCI_VENDOR_ID_ITE, 0x8212, NT, "ITE", "8212F PATA RAID"},
{0}, {0},
@ -53,7 +53,7 @@ static const struct par_master par_master_it8212 = {
.chip_writen = fallback_chip_writen, .chip_writen = fallback_chip_writen,
}; };
int it8212_init(void) static int it8212_init(void)
{ {
if (rget_io_perms()) if (rget_io_perms())
return 1; return 1;
@ -78,3 +78,12 @@ int it8212_init(void)
register_par_master(&par_master_it8212, BUS_PARALLEL, NULL); register_par_master(&par_master_it8212, BUS_PARALLEL, NULL);
return 0; return 0;
} }
const struct programmer_entry programmer_it8212 = {
.name = "it8212",
.type = PCI,
.devs.dev = devs_it8212,
.init = it8212_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -181,7 +181,7 @@ static int jlink_spi_shutdown(void *data)
return 0; return 0;
} }
int jlink_spi_init(void) static int jlink_spi_init(void)
{ {
char *arg; char *arg;
unsigned long speed = 0; unsigned long speed = 0;
@ -486,3 +486,13 @@ init_err:
return 1; return 1;
} }
const struct programmer_entry programmer_jlink_spi = {
.name = "jlink_spi",
.type = OTHER,
.init = jlink_spi_init,
.devs.note = "SEGGER J-Link and compatible devices\n",
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -295,7 +295,7 @@ static int linux_mtd_erase(struct flashctx *flash,
return 0; return 0;
} }
static const struct opaque_master programmer_linux_mtd = { static const struct opaque_master linux_mtd_opaque_master = {
/* max_data_{read,write} don't have any effect for this programmer */ /* max_data_{read,write} don't have any effect for this programmer */
.max_data_read = MAX_DATA_UNSPECIFIED, .max_data_read = MAX_DATA_UNSPECIFIED,
.max_data_write = MAX_DATA_UNSPECIFIED, .max_data_write = MAX_DATA_UNSPECIFIED,
@ -367,7 +367,7 @@ static int linux_mtd_shutdown(void *data)
return 0; return 0;
} }
int linux_mtd_init(void) static int linux_mtd_init(void)
{ {
char *param; char *param;
int dev_num = 0; int dev_num = 0;
@ -422,10 +422,20 @@ int linux_mtd_init(void)
goto linux_mtd_init_exit; goto linux_mtd_init_exit;
} }
register_opaque_master(&programmer_linux_mtd, data); register_opaque_master(&linux_mtd_opaque_master, data);
ret = 0; ret = 0;
linux_mtd_init_exit: linux_mtd_init_exit:
free(param); free(param);
return ret; return ret;
} }
const struct programmer_entry programmer_linux_mtd = {
.name = "linux_mtd",
.type = OTHER,
.devs.note = "Device files /dev/mtd*\n",
.init = linux_mtd_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -165,7 +165,7 @@ out:
return result; return result;
} }
int linux_spi_init(void) static int linux_spi_init(void)
{ {
char *p, *endp, *dev; char *p, *endp, *dev;
uint32_t speed_hz = 2 * 1000 * 1000; uint32_t speed_hz = 2 * 1000 * 1000;
@ -251,4 +251,14 @@ init_err:
return 1; return 1;
} }
const struct programmer_entry programmer_linux_spi = {
.name = "linux_spi",
.type = OTHER,
.devs.note = "Device files /dev/spidev*.*\n",
.init = linux_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif // CONFIG_LINUX_SPI == 1 #endif // CONFIG_LINUX_SPI == 1

View File

@ -433,7 +433,7 @@ static int lspcon_i2c_spi_shutdown(void *data)
return ret; return ret;
} }
int lspcon_i2c_spi_init(void) static int lspcon_i2c_spi_init(void)
{ {
int fd = i2c_open_from_programmer_params(REGISTER_ADDRESS, 0); int fd = i2c_open_from_programmer_params(REGISTER_ADDRESS, 0);
if (fd < 0) if (fd < 0)
@ -460,3 +460,13 @@ int lspcon_i2c_spi_init(void)
return ret; return ret;
} }
const struct programmer_entry programmer_lspcon_i2c_spi = {
.name = "lspcon_i2c_spi",
.type = OTHER,
.devs.note = "Device files /dev/i2c-*.\n",
.init = lspcon_i2c_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -419,7 +419,7 @@ static int check_params(void)
return ret; return ret;
} }
int mec1308_init(void) static int mec1308_init(void)
{ {
uint16_t sio_port; uint16_t sio_port;
uint8_t device_id; uint8_t device_id;
@ -521,4 +521,15 @@ init_err_exit:
free(ctx_data); free(ctx_data);
return 1; return 1;
} }
const struct programmer_entry programmer_mec1308 = {
.name = "mec1308",
.type = OTHER,
.devs.note = "Microchip MEC1308 Embedded Controller.\n",
.init = mec1308_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif #endif

View File

@ -150,7 +150,7 @@ static const struct spi_master spi_master_mstarddc = {
}; };
/* Returns 0 upon success, a negative number upon errors. */ /* Returns 0 upon success, a negative number upon errors. */
int mstarddc_spi_init(void) static int mstarddc_spi_init(void)
{ {
int ret = 0; int ret = 0;
int mstarddc_fd = -1; int mstarddc_fd = -1;
@ -252,4 +252,14 @@ out:
return ret; return ret;
} }
const struct programmer_entry programmer_mstarddc_spi = {
.name = "mstarddc_spi",
.type = OTHER,
.devs.note = "MSTAR DDC devices addressable via /dev/i2c-* on Linux.\n",
.init = mstarddc_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif #endif

View File

@ -538,7 +538,7 @@ static const struct spi_master spi_programmer_ni845x = {
.write_aai = default_spi_write_aai, .write_aai = default_spi_write_aai,
}; };
int ni845x_spi_init(void) static int ni845x_spi_init(void)
{ {
char *speed_str = NULL; char *speed_str = NULL;
char *CS_str = NULL; char *CS_str = NULL;
@ -634,3 +634,13 @@ int ni845x_spi_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_ni845x_spi = {
.name = "ni845x_spi",
.type = OTHER, // choose other because NI-845x uses own USB implementation
.devs.note = "National Instruments USB-845x\n",
.init = ni845x_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -35,7 +35,7 @@ struct nic3com_data {
uint16_t id; uint16_t id;
}; };
const struct dev_entry nics_3com[] = { static const struct dev_entry nics_3com[] = {
/* 3C90xB */ /* 3C90xB */
{0x10b7, 0x9055, OK, "3COM", "3C90xB: PCI 10/100 Mbps; shared 10BASE-T/100BASE-TX"}, {0x10b7, 0x9055, OK, "3COM", "3C90xB: PCI 10/100 Mbps; shared 10BASE-T/100BASE-TX"},
{0x10b7, 0x9001, NT, "3COM", "3C90xB: PCI 10/100 Mbps; shared 10BASE-T/100BASE-T4" }, {0x10b7, 0x9001, NT, "3COM", "3C90xB: PCI 10/100 Mbps; shared 10BASE-T/100BASE-T4" },
@ -101,7 +101,7 @@ static int nic3com_shutdown(void *par_data)
return 0; return 0;
} }
int nic3com_init(void) static int nic3com_init(void)
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
uint32_t io_base_addr = 0; uint32_t io_base_addr = 0;
@ -169,6 +169,16 @@ init_err_cleanup_exit:
return 1; return 1;
} }
const struct programmer_entry programmer_nic3com = {
.name = "nic3com",
.type = PCI,
.devs.dev = nics_3com,
.init = nic3com_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#else #else
#error PCI port I/O access is not supported on this architecture yet. #error PCI port I/O access is not supported on this architecture yet.
#endif #endif

View File

@ -23,7 +23,7 @@
static uint8_t *nicintel_bar; static uint8_t *nicintel_bar;
static uint8_t *nicintel_control_bar; static uint8_t *nicintel_control_bar;
const struct dev_entry nics_intel[] = { static const struct dev_entry nics_intel[] = {
{PCI_VENDOR_ID_INTEL, 0x1209, NT, "Intel", "8255xER/82551IT Fast Ethernet Controller"}, {PCI_VENDOR_ID_INTEL, 0x1209, NT, "Intel", "8255xER/82551IT Fast Ethernet Controller"},
{PCI_VENDOR_ID_INTEL, 0x1229, OK, "Intel", "82557/8/9/0/1 Ethernet Pro 100"}, {PCI_VENDOR_ID_INTEL, 0x1229, OK, "Intel", "82557/8/9/0/1 Ethernet Pro 100"},
@ -63,7 +63,7 @@ static const struct par_master par_master_nicintel = {
.chip_writen = fallback_chip_writen, .chip_writen = fallback_chip_writen,
}; };
int nicintel_init(void) static int nicintel_init(void)
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
uintptr_t addr; uintptr_t addr;
@ -111,3 +111,13 @@ int nicintel_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_nicintel = {
.name = "nicintel",
.type = PCI,
.devs.dev = nics_intel,
.init = nicintel_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -81,7 +81,7 @@ static bool done_i20_write = false;
* Warning: is_i210() below makes assumptions on these PCI ids. * Warning: is_i210() below makes assumptions on these PCI ids.
* It may have to be updated when this list is extended. * It may have to be updated when this list is extended.
*/ */
const struct dev_entry nics_intel_ee[] = { static const struct dev_entry nics_intel_ee[] = {
{PCI_VENDOR_ID_INTEL, 0x150e, OK, "Intel", "82580 Quad Gigabit Ethernet Controller (Copper)"}, {PCI_VENDOR_ID_INTEL, 0x150e, OK, "Intel", "82580 Quad Gigabit Ethernet Controller (Copper)"},
{PCI_VENDOR_ID_INTEL, 0x150f, NT , "Intel", "82580 Quad Gigabit Ethernet Controller (Fiber)"}, {PCI_VENDOR_ID_INTEL, 0x150f, NT , "Intel", "82580 Quad Gigabit Ethernet Controller (Fiber)"},
{PCI_VENDOR_ID_INTEL, 0x1510, NT , "Intel", "82580 Quad Gigabit Ethernet Controller (Backplane)"}, {PCI_VENDOR_ID_INTEL, 0x1510, NT , "Intel", "82580 Quad Gigabit Ethernet Controller (Backplane)"},
@ -447,7 +447,7 @@ static int nicintel_ee_shutdown_82580(void *eecp)
return ret; return ret;
} }
int nicintel_ee_init(void) static int nicintel_ee_init(void)
{ {
if (rget_io_perms()) if (rget_io_perms())
return 1; return 1;
@ -501,3 +501,13 @@ int nicintel_ee_init(void)
return 1; return 1;
} }
const struct programmer_entry programmer_nicintel_eeprom = {
.name = "nicintel_eeprom",
.type = PCI,
.devs.dev = nics_intel_ee,
.init = nicintel_ee_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -79,7 +79,7 @@ struct nicintel_spi_data {
uint8_t *spibar; uint8_t *spibar;
}; };
const struct dev_entry nics_intel_spi[] = { static const struct dev_entry nics_intel_spi[] = {
{PCI_VENDOR_ID_INTEL, 0x105e, OK, "Intel", "82571EB Gigabit Ethernet Controller"}, {PCI_VENDOR_ID_INTEL, 0x105e, OK, "Intel", "82571EB Gigabit Ethernet Controller"},
{PCI_VENDOR_ID_INTEL, 0x1076, OK, "Intel", "82541GI Gigabit Ethernet Controller"}, {PCI_VENDOR_ID_INTEL, 0x1076, OK, "Intel", "82541GI Gigabit Ethernet Controller"},
{PCI_VENDOR_ID_INTEL, 0x107c, OK, "Intel", "82541PI Gigabit Ethernet Controller"}, {PCI_VENDOR_ID_INTEL, 0x107c, OK, "Intel", "82541PI Gigabit Ethernet Controller"},
@ -259,7 +259,7 @@ static int nicintel_spi_i210_enable_flash(struct nicintel_spi_data *data)
return 0; return 0;
} }
int nicintel_spi_init(void) static int nicintel_spi_init(void)
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
@ -308,3 +308,13 @@ int nicintel_spi_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_nicintel_spi = {
.name = "nicintel_spi",
.type = PCI,
.devs.dev = nics_intel_spi,
.init = nicintel_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -27,7 +27,7 @@
#define BOOT_ROM_DATA 0x54 #define BOOT_ROM_DATA 0x54
static uint32_t io_base_addr = 0; static uint32_t io_base_addr = 0;
const struct dev_entry nics_natsemi[] = { static const struct dev_entry nics_natsemi[] = {
{0x100b, 0x0020, NT, "National Semiconductor", "DP83815/DP83816"}, {0x100b, 0x0020, NT, "National Semiconductor", "DP83815/DP83816"},
{0x100b, 0x0022, NT, "National Semiconductor", "DP83820"}, {0x100b, 0x0022, NT, "National Semiconductor", "DP83820"},
@ -75,7 +75,7 @@ static const struct par_master par_master_nicnatsemi = {
.chip_writen = fallback_chip_writen, .chip_writen = fallback_chip_writen,
}; };
int nicnatsemi_init(void) static int nicnatsemi_init(void)
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
@ -102,6 +102,17 @@ int nicnatsemi_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_nicnatsemi = {
.name = "nicnatsemi",
.type = PCI,
.devs.dev = nics_natsemi,
.init = nicnatsemi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#else #else
#error PCI port I/O access is not supported on this architecture yet. #error PCI port I/O access is not supported on this architecture yet.
#endif #endif

View File

@ -27,7 +27,7 @@
static uint32_t io_base_addr = 0; static uint32_t io_base_addr = 0;
static int bios_rom_addr, bios_rom_data; static int bios_rom_addr, bios_rom_data;
const struct dev_entry nics_realtek[] = { static const struct dev_entry nics_realtek[] = {
{0x10ec, 0x8139, OK, "Realtek", "RTL8139/8139C/8139C+"}, {0x10ec, 0x8139, OK, "Realtek", "RTL8139/8139C/8139C+"},
{0x10ec, 0x8169, NT, "Realtek", "RTL8169"}, {0x10ec, 0x8169, NT, "Realtek", "RTL8169"},
{0x1113, 0x1211, OK, "SMC", "1211TX"}, /* RTL8139 clone */ {0x1113, 0x1211, OK, "SMC", "1211TX"}, /* RTL8139 clone */
@ -90,7 +90,7 @@ static int nicrealtek_shutdown(void *data)
return 0; return 0;
} }
int nicrealtek_init(void) static int nicrealtek_init(void)
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
@ -127,6 +127,16 @@ int nicrealtek_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_nicrealtek = {
.name = "nicrealtek",
.type = PCI,
.devs.dev = nics_realtek,
.init = nicrealtek_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#else #else
#error PCI port I/O access is not supported on this architecture yet. #error PCI port I/O access is not supported on this architecture yet.
#endif #endif

View File

@ -45,7 +45,7 @@ struct ogp_spi_data {
uint32_t reg_sck; uint32_t reg_sck;
}; };
const struct dev_entry ogp_spi[] = { static const struct dev_entry ogp_spi[] = {
{PCI_VENDOR_ID_OGP, 0x0000, OK, "Open Graphics Project", "Development Board OGD1"}, {PCI_VENDOR_ID_OGP, 0x0000, OK, "Open Graphics Project", "Development Board OGD1"},
{0}, {0},
@ -106,7 +106,7 @@ static int ogp_spi_shutdown(void *data)
return 0; return 0;
} }
int ogp_spi_init(void) static int ogp_spi_init(void)
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
char *type; char *type;
@ -174,3 +174,13 @@ int ogp_spi_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_ogp_spi = {
.name = "ogp_spi",
.type = PCI,
.devs.dev = ogp_spi,
.init = ogp_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -46,7 +46,7 @@
#include "programmer.h" #include "programmer.h"
#include "spi.h" #include "spi.h"
const struct dev_entry devs_pickit2_spi[] = { static const struct dev_entry devs_pickit2_spi[] = {
{0x04D8, 0x0033, OK, "Microchip", "PICkit 2"}, {0x04D8, 0x0033, OK, "Microchip", "PICkit 2"},
{0} {0}
@ -388,7 +388,7 @@ static int pickit2_shutdown(void *data)
return ret; return ret;
} }
int pickit2_spi_init(void) static int pickit2_spi_init(void)
{ {
uint8_t buf[CMD_LENGTH] = { uint8_t buf[CMD_LENGTH] = {
CMD_EXEC_SCRIPT, CMD_EXEC_SCRIPT,
@ -508,3 +508,13 @@ init_err_cleanup_exit:
pickit2_shutdown(pickit2_data); pickit2_shutdown(pickit2_data);
return 1; return 1;
} }
const struct programmer_entry programmer_pickit2_spi = {
.name = "pickit2_spi",
.type = USB,
.devs.dev = devs_pickit2_spi,
.init = pickit2_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -120,7 +120,7 @@ static int pony_spi_shutdown(void *data)
return ret; return ret;
} }
int pony_spi_init(void) static int pony_spi_init(void)
{ {
int i, data_out; int i, data_out;
char *arg = NULL; char *arg = NULL;
@ -250,3 +250,14 @@ int pony_spi_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_pony_spi = {
.name = "pony_spi",
.type = OTHER,
/* FIXME */
.devs.note = "Programmers compatible with SI-Prog, serbang or AJAWe\n",
.init = pony_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -362,7 +362,7 @@ extern int force_boardmismatch;
void probe_superio(void); void probe_superio(void);
int register_superio(struct superio s); int register_superio(struct superio s);
extern enum chipbustype internal_buses_supported; extern enum chipbustype internal_buses_supported;
int internal_init(void); extern const struct programmer_entry programmer_internal;
#endif #endif
/* hwaccess.c */ /* hwaccess.c */
@ -400,146 +400,122 @@ void rmmio_vall(void *addr);
/* dummyflasher.c */ /* dummyflasher.c */
#if CONFIG_DUMMY == 1 #if CONFIG_DUMMY == 1
int dummy_init(void); extern const struct programmer_entry programmer_dummy;
void *dummy_map(const char *descr, uintptr_t phys_addr, size_t len);
void dummy_unmap(void *virt_addr, size_t len);
#endif #endif
/* nic3com.c */ /* nic3com.c */
#if CONFIG_NIC3COM == 1 #if CONFIG_NIC3COM == 1
int nic3com_init(void); extern const struct programmer_entry programmer_nic3com;
extern const struct dev_entry nics_3com[];
#endif #endif
/* gfxnvidia.c */ /* gfxnvidia.c */
#if CONFIG_GFXNVIDIA == 1 #if CONFIG_GFXNVIDIA == 1
int gfxnvidia_init(void); extern const struct programmer_entry programmer_gfxnvidia;
extern const struct dev_entry gfx_nvidia[];
#endif #endif
/* raiden_debug_spi.c */ /* raiden_debug_spi.c */
#if CONFIG_RAIDEN_DEBUG_SPI == 1 #if CONFIG_RAIDEN_DEBUG_SPI == 1
int raiden_debug_spi_init(void); extern const struct programmer_entry programmer_raiden_debug_spi;
extern const struct dev_entry devs_raiden[];
#endif #endif
/* drkaiser.c */ /* drkaiser.c */
#if CONFIG_DRKAISER == 1 #if CONFIG_DRKAISER == 1
int drkaiser_init(void); extern const struct programmer_entry programmer_drkaiser;
extern const struct dev_entry drkaiser_pcidev[];
#endif #endif
/* nicrealtek.c */ /* nicrealtek.c */
#if CONFIG_NICREALTEK == 1 #if CONFIG_NICREALTEK == 1
int nicrealtek_init(void); extern const struct programmer_entry programmer_nicrealtek;
extern const struct dev_entry nics_realtek[];
#endif #endif
/* nicnatsemi.c */ /* nicnatsemi.c */
#if CONFIG_NICNATSEMI == 1 #if CONFIG_NICNATSEMI == 1
int nicnatsemi_init(void); extern const struct programmer_entry programmer_nicnatsemi;
extern const struct dev_entry nics_natsemi[];
#endif #endif
/* nicintel.c */ /* nicintel.c */
#if CONFIG_NICINTEL == 1 #if CONFIG_NICINTEL == 1
int nicintel_init(void); extern const struct programmer_entry programmer_nicintel;
extern const struct dev_entry nics_intel[];
#endif #endif
/* nicintel_spi.c */ /* nicintel_spi.c */
#if CONFIG_NICINTEL_SPI == 1 #if CONFIG_NICINTEL_SPI == 1
int nicintel_spi_init(void); extern const struct programmer_entry programmer_nicintel_spi;
extern const struct dev_entry nics_intel_spi[];
#endif #endif
/* nicintel_eeprom.c */ /* nicintel_eeprom.c */
#if CONFIG_NICINTEL_EEPROM == 1 #if CONFIG_NICINTEL_EEPROM == 1
int nicintel_ee_init(void); extern const struct programmer_entry programmer_nicintel_eeprom;
extern const struct dev_entry nics_intel_ee[];
#endif #endif
/* ogp_spi.c */ /* ogp_spi.c */
#if CONFIG_OGP_SPI == 1 #if CONFIG_OGP_SPI == 1
int ogp_spi_init(void); extern const struct programmer_entry programmer_ogp_spi;
extern const struct dev_entry ogp_spi[];
#endif #endif
/* satamv.c */ /* satamv.c */
#if CONFIG_SATAMV == 1 #if CONFIG_SATAMV == 1
int satamv_init(void); extern const struct programmer_entry programmer_satamv;
extern const struct dev_entry satas_mv[];
#endif #endif
/* satasii.c */ /* satasii.c */
#if CONFIG_SATASII == 1 #if CONFIG_SATASII == 1
int satasii_init(void); extern const struct programmer_entry programmer_satasii;
extern const struct dev_entry satas_sii[];
#endif #endif
/* atahpt.c */ /* atahpt.c */
#if CONFIG_ATAHPT == 1 #if CONFIG_ATAHPT == 1
int atahpt_init(void); extern const struct programmer_entry programmer_atahpt;
extern const struct dev_entry ata_hpt[];
#endif #endif
/* atavia.c */ /* atavia.c */
#if CONFIG_ATAVIA == 1 #if CONFIG_ATAVIA == 1
int atavia_init(void); extern const struct programmer_entry programmer_atavia;
void *atavia_map(const char *descr, uintptr_t phys_addr, size_t len);
extern const struct dev_entry ata_via[];
#endif #endif
/* atapromise.c */ /* atapromise.c */
#if CONFIG_ATAPROMISE == 1 #if CONFIG_ATAPROMISE == 1
int atapromise_init(void); extern const struct programmer_entry programmer_atapromise;
void *atapromise_map(const char *descr, uintptr_t phys_addr, size_t len);
extern const struct dev_entry ata_promise[];
#endif #endif
/* it8212.c */ /* it8212.c */
#if CONFIG_IT8212 == 1 #if CONFIG_IT8212 == 1
int it8212_init(void); extern const struct programmer_entry programmer_it8212;
extern const struct dev_entry devs_it8212[];
#endif #endif
/* ft2232_spi.c */ /* ft2232_spi.c */
#if CONFIG_FT2232_SPI == 1 #if CONFIG_FT2232_SPI == 1
int ft2232_spi_init(void); extern const struct programmer_entry programmer_ft2232_spi;
extern const struct dev_entry devs_ft2232spi[];
#endif #endif
/* usbblaster_spi.c */ /* usbblaster_spi.c */
#if CONFIG_USBBLASTER_SPI == 1 #if CONFIG_USBBLASTER_SPI == 1
int usbblaster_spi_init(void); extern const struct programmer_entry programmer_usbblaster_spi;
extern const struct dev_entry devs_usbblasterspi[];
#endif #endif
/* mstarddc_spi.c */ /* mstarddc_spi.c */
#if CONFIG_MSTARDDC_SPI == 1 #if CONFIG_MSTARDDC_SPI == 1
int mstarddc_spi_init(void); extern const struct programmer_entry programmer_mstarddc_spi;
#endif #endif
/* pickit2_spi.c */ /* pickit2_spi.c */
#if CONFIG_PICKIT2_SPI == 1 #if CONFIG_PICKIT2_SPI == 1
int pickit2_spi_init(void); extern const struct programmer_entry programmer_pickit2_spi;
extern const struct dev_entry devs_pickit2_spi[];
#endif #endif
/* stlinkv3_spi.c */ /* stlinkv3_spi.c */
#if CONFIG_STLINKV3_SPI == 1 #if CONFIG_STLINKV3_SPI == 1
int stlinkv3_spi_init(void); extern const struct programmer_entry programmer_stlinkv3_spi;
extern const struct dev_entry devs_stlinkv3_spi[];
#endif #endif
/* rayer_spi.c */ /* rayer_spi.c */
#if CONFIG_RAYER_SPI == 1 #if CONFIG_RAYER_SPI == 1
int rayer_spi_init(void); extern const struct programmer_entry programmer_rayer_spi;
#endif #endif
/* pony_spi.c */ /* pony_spi.c */
#if CONFIG_PONY_SPI == 1 #if CONFIG_PONY_SPI == 1
int pony_spi_init(void); extern const struct programmer_entry programmer_pony_spi;
#endif #endif
/* bitbang_spi.c */ /* bitbang_spi.c */
@ -547,57 +523,52 @@ int register_spi_bitbang_master(const struct bitbang_spi_master *master, void *s
/* buspirate_spi.c */ /* buspirate_spi.c */
#if CONFIG_BUSPIRATE_SPI == 1 #if CONFIG_BUSPIRATE_SPI == 1
int buspirate_spi_init(void); extern const struct programmer_entry programmer_buspirate_spi;
#endif #endif
/* linux_mtd.c */ /* linux_mtd.c */
#if CONFIG_LINUX_MTD == 1 #if CONFIG_LINUX_MTD == 1
int linux_mtd_init(void); extern const struct programmer_entry programmer_linux_mtd;
#endif #endif
/* linux_spi.c */ /* linux_spi.c */
#if CONFIG_LINUX_SPI == 1 #if CONFIG_LINUX_SPI == 1
int linux_spi_init(void); extern const struct programmer_entry programmer_linux_spi;
#endif #endif
/* dediprog.c */ /* dediprog.c */
#if CONFIG_DEDIPROG == 1 #if CONFIG_DEDIPROG == 1
int dediprog_init(void); extern const struct programmer_entry programmer_dediprog;
extern const struct dev_entry devs_dediprog[];
#endif #endif
/* developerbox_spi.c */ /* developerbox_spi.c */
#if CONFIG_DEVELOPERBOX_SPI == 1 #if CONFIG_DEVELOPERBOX_SPI == 1
int developerbox_spi_init(void); extern const struct programmer_entry programmer_developerbox;
extern const struct dev_entry devs_developerbox_spi[];
#endif #endif
/* ch341a_spi.c */ /* ch341a_spi.c */
#if CONFIG_CH341A_SPI == 1 #if CONFIG_CH341A_SPI == 1
int ch341a_spi_init(void); extern const struct programmer_entry programmer_ch341a_spi;
void ch341a_spi_delay(unsigned int usecs);
extern const struct dev_entry devs_ch341a_spi[];
#endif #endif
/* digilent_spi.c */ /* digilent_spi.c */
#if CONFIG_DIGILENT_SPI == 1 #if CONFIG_DIGILENT_SPI == 1
int digilent_spi_init(void); extern const struct programmer_entry programmer_digilent_spi;
extern const struct dev_entry devs_digilent_spi[];
#endif #endif
/* ene_lpc.c */ /* ene_lpc.c */
#if CONFIG_ENE_LPC == 1 #if CONFIG_ENE_LPC == 1
int ene_lpc_init(void); extern const struct programmer_entry programmer_ene_lpc;
#endif #endif
/* jlink_spi.c */ /* jlink_spi.c */
#if CONFIG_JLINK_SPI == 1 #if CONFIG_JLINK_SPI == 1
int jlink_spi_init(void); extern const struct programmer_entry programmer_jlink_spi;
#endif #endif
/* ni845x_spi.c */ /* ni845x_spi.c */
#if CONFIG_NI845X_SPI == 1 #if CONFIG_NI845X_SPI == 1
int ni845x_spi_init(void); extern const struct programmer_entry programmer_ni845x_spi;
#endif #endif
/* flashrom.c */ /* flashrom.c */
@ -695,7 +666,7 @@ int init_superio_ite(void);
#if CONFIG_LINUX_MTD == 1 #if CONFIG_LINUX_MTD == 1
/* trivial wrapper to avoid cluttering internal_init() with #if */ /* trivial wrapper to avoid cluttering internal_init() with #if */
static inline int try_mtd(void) { return linux_mtd_init(); }; static inline int try_mtd(void) { return programmer_linux_mtd.init(); };
#else #else
static inline int try_mtd(void) { return 1; }; static inline int try_mtd(void) { return 1; };
#endif #endif
@ -705,7 +676,7 @@ int mcp6x_spi_init(int want_spi);
/* mec1308.c */ /* mec1308.c */
#if CONFIG_MEC1308 == 1 #if CONFIG_MEC1308 == 1
int mec1308_init(void); extern const struct programmer_entry programmer_mec1308;
#endif #endif
/* sb600spi.c */ /* sb600spi.c */
@ -763,9 +734,7 @@ int register_master(const struct registered_master *mst);
/* serprog.c */ /* serprog.c */
#if CONFIG_SERPROG == 1 #if CONFIG_SERPROG == 1
int serprog_init(void); extern const struct programmer_entry programmer_serprog;
void serprog_delay(unsigned int usecs);
void *serprog_map(const char *descr, uintptr_t phys_addr, size_t len);
#endif #endif
/* serial.c */ /* serial.c */
@ -836,12 +805,12 @@ struct libusb_device_handle *usb_dev_get_by_vid_pid_number(
/* lspcon_i2c_spi.c */ /* lspcon_i2c_spi.c */
#if CONFIG_LSPCON_I2C_SPI == 1 #if CONFIG_LSPCON_I2C_SPI == 1
int lspcon_i2c_spi_init(void); extern const struct programmer_entry programmer_lspcon_i2c_spi;
#endif #endif
/* realtek_mst_i2c_spi.c */ /* realtek_mst_i2c_spi.c */
#if CONFIG_REALTEK_MST_I2C_SPI == 1 #if CONFIG_REALTEK_MST_I2C_SPI == 1
int realtek_mst_i2c_spi_init(void); extern const struct programmer_entry programmer_realtek_mst_i2c_spi;
#endif #endif
#endif /* !__PROGRAMMER_H__ */ #endif /* !__PROGRAMMER_H__ */

View File

@ -14,480 +14,6 @@
#include "programmer.h" #include "programmer.h"
#if CONFIG_INTERNAL == 1
const struct programmer_entry programmer_internal = {
.name = "internal",
.type = OTHER,
.devs.note = NULL,
.init = internal_init,
.map_flash_region = physmap,
.unmap_flash_region = physunmap,
.delay = internal_delay,
};
#endif
#if CONFIG_DUMMY == 1
const struct programmer_entry programmer_dummy = {
.name = "dummy",
.type = OTHER,
/* FIXME */
.devs.note = "Dummy device, does nothing and logs all accesses\n",
.init = dummy_init,
.map_flash_region = dummy_map,
.unmap_flash_region = dummy_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_MEC1308 == 1
const struct programmer_entry programmer_mec1308 = {
.name = "mec1308",
.type = OTHER,
.devs.note = "Microchip MEC1308 Embedded Controller.\n",
.init = mec1308_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_NIC3COM == 1
const struct programmer_entry programmer_nic3com = {
.name = "nic3com",
.type = PCI,
.devs.dev = nics_3com,
.init = nic3com_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_NICREALTEK == 1
const struct programmer_entry programmer_nicrealtek = {
/* This programmer works for Realtek RTL8139 and SMC 1211. */
.name = "nicrealtek",
.type = PCI,
.devs.dev = nics_realtek,
.init = nicrealtek_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_NICNATSEMI == 1
const struct programmer_entry programmer_nicnatsemi = {
.name = "nicnatsemi",
.type = PCI,
.devs.dev = nics_natsemi,
.init = nicnatsemi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_GFXNVIDIA == 1
const struct programmer_entry programmer_gfxnvidia = {
.name = "gfxnvidia",
.type = PCI,
.devs.dev = gfx_nvidia,
.init = gfxnvidia_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_RAIDEN_DEBUG_SPI == 1
const struct programmer_entry programmer_raiden_debug_spi = {
.name = "raiden_debug_spi",
.type = USB,
.devs.dev = devs_raiden,
.init = raiden_debug_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_DRKAISER == 1
const struct programmer_entry programmer_drkaiser = {
.name = "drkaiser",
.type = PCI,
.devs.dev = drkaiser_pcidev,
.init = drkaiser_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_SATASII == 1
const struct programmer_entry programmer_satasii = {
.name = "satasii",
.type = PCI,
.devs.dev = satas_sii,
.init = satasii_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_ATAHPT == 1
const struct programmer_entry programmer_atahpt = {
.name = "atahpt",
.type = PCI,
.devs.dev = ata_hpt,
.init = atahpt_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_ATAVIA == 1
const struct programmer_entry programmer_atavia = {
.name = "atavia",
.type = PCI,
.devs.dev = ata_via,
.init = atavia_init,
.map_flash_region = atavia_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_ATAPROMISE == 1
const struct programmer_entry programmer_atapromise = {
.name = "atapromise",
.type = PCI,
.devs.dev = ata_promise,
.init = atapromise_init,
.map_flash_region = atapromise_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_IT8212 == 1
const struct programmer_entry programmer_it8212 = {
.name = "it8212",
.type = PCI,
.devs.dev = devs_it8212,
.init = it8212_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_FT2232_SPI == 1
const struct programmer_entry programmer_ft2232_spi = {
.name = "ft2232_spi",
.type = USB,
.devs.dev = devs_ft2232spi,
.init = ft2232_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_SERPROG == 1
const struct programmer_entry programmer_serprog = {
.name = "serprog",
.type = OTHER,
/* FIXME */
.devs.note = "All programmer devices speaking the serprog protocol\n",
.init = serprog_init,
.map_flash_region = serprog_map,
.unmap_flash_region = fallback_unmap,
.delay = serprog_delay,
};
#endif
#if CONFIG_BUSPIRATE_SPI == 1
const struct programmer_entry programmer_buspirate_spi = {
.name = "buspirate_spi",
.type = OTHER,
/* FIXME */
.devs.note = "Dangerous Prototypes Bus Pirate\n",
.init = buspirate_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_DEDIPROG == 1
const struct programmer_entry programmer_dediprog = {
.name = "dediprog",
.type = USB,
.devs.dev = devs_dediprog,
.init = dediprog_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_DEVELOPERBOX_SPI == 1
const struct programmer_entry programmer_developerbox = {
.name = "developerbox",
.type = USB,
.devs.dev = devs_developerbox_spi,
.init = developerbox_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_ENE_LPC == 1
const struct programmer_entry programmer_ene_lpc = {
.name = "ene_lpc",
.type = OTHER,
.devs.note = "ENE LPC interface keyboard controller\n",
.init = ene_lpc_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_RAYER_SPI == 1
const struct programmer_entry programmer_rayer_spi = {
.name = "rayer_spi",
.type = OTHER,
/* FIXME */
.devs.note = "RayeR parallel port programmer\n",
.init = rayer_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_PONY_SPI == 1
const struct programmer_entry programmer_pony_spi = {
.name = "pony_spi",
.type = OTHER,
/* FIXME */
.devs.note = "Programmers compatible with SI-Prog, serbang or AJAWe\n",
.init = pony_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_NICINTEL == 1
const struct programmer_entry programmer_nicintel = {
.name = "nicintel",
.type = PCI,
.devs.dev = nics_intel,
.init = nicintel_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_NICINTEL_SPI == 1
const struct programmer_entry programmer_nicintel_spi = {
.name = "nicintel_spi",
.type = PCI,
.devs.dev = nics_intel_spi,
.init = nicintel_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_NICINTEL_EEPROM == 1
const struct programmer_entry programmer_nicintel_eeprom = {
.name = "nicintel_eeprom",
.type = PCI,
.devs.dev = nics_intel_ee,
.init = nicintel_ee_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_OGP_SPI == 1
const struct programmer_entry programmer_ogp_spi = {
.name = "ogp_spi",
.type = PCI,
.devs.dev = ogp_spi,
.init = ogp_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_SATAMV == 1
const struct programmer_entry programmer_satamv = {
.name = "satamv",
.type = PCI,
.devs.dev = satas_mv,
.init = satamv_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_LINUX_MTD == 1
const struct programmer_entry programmer_linux_mtd = {
.name = "linux_mtd",
.type = OTHER,
.devs.note = "Device files /dev/mtd*\n",
.init = linux_mtd_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_LINUX_SPI == 1
const struct programmer_entry programmer_linux_spi = {
.name = "linux_spi",
.type = OTHER,
.devs.note = "Device files /dev/spidev*.*\n",
.init = linux_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_LSPCON_I2C_SPI == 1
const struct programmer_entry programmer_lspcon_i2c_spi = {
.name = "lspcon_i2c_spi",
.type = OTHER,
.devs.note = "Device files /dev/i2c-*.\n",
.init = lspcon_i2c_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_REALTEK_MST_I2C_SPI == 1
const struct programmer_entry programmer_realtek_mst_i2c_spi = {
.name = "realtek_mst_i2c_spi",
.type = OTHER,
.devs.note = "Device files /dev/i2c-*.\n",
.init = realtek_mst_i2c_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_USBBLASTER_SPI == 1
const struct programmer_entry programmer_usbblaster_spi = {
.name = "usbblaster_spi",
.type = USB,
.devs.dev = devs_usbblasterspi,
.init = usbblaster_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_MSTARDDC_SPI == 1
const struct programmer_entry programmer_mstarddc_spi = {
.name = "mstarddc_spi",
.type = OTHER,
.devs.note = "MSTAR DDC devices addressable via /dev/i2c-* on Linux.\n",
.init = mstarddc_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_PICKIT2_SPI == 1
const struct programmer_entry programmer_pickit2_spi = {
.name = "pickit2_spi",
.type = USB,
.devs.dev = devs_pickit2_spi,
.init = pickit2_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_CH341A_SPI == 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,
};
#endif
#if CONFIG_DIGILENT_SPI == 1
const struct programmer_entry programmer_digilent_spi = {
.name = "digilent_spi",
.type = USB,
.devs.dev = devs_digilent_spi,
.init = digilent_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_JLINK_SPI == 1
const struct programmer_entry programmer_jlink_spi = {
.name = "jlink_spi",
.type = OTHER,
.init = jlink_spi_init,
.devs.note = "SEGGER J-Link and compatible devices\n",
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_NI845X_SPI == 1
const struct programmer_entry programmer_ni845x_spi = {
.name = "ni845x_spi",
.type = OTHER, // choose other because NI-845x uses own USB implementation
.devs.note = "National Instruments USB-845x\n",
.init = ni845x_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
#if CONFIG_STLINKV3_SPI == 1
const struct programmer_entry programmer_stlinkv3_spi = {
.name = "stlinkv3_spi",
.type = USB,
.devs.dev = devs_stlinkv3_spi,
.init = stlinkv3_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif
const struct programmer_entry *const programmer_table[] = { const struct programmer_entry *const programmer_table[] = {
#if CONFIG_INTERNAL == 1 #if CONFIG_INTERNAL == 1

View File

@ -349,7 +349,7 @@
#include <unistd.h> #include <unistd.h>
/* FIXME: Add some programmer IDs here */ /* FIXME: Add some programmer IDs here */
const struct dev_entry devs_raiden[] = { static const struct dev_entry devs_raiden[] = {
{0}, {0},
}; };
@ -1454,7 +1454,7 @@ static void free_dev_list(struct usb_device **dev_lst)
dev = usb_device_free(dev); dev = usb_device_free(dev);
} }
int raiden_debug_spi_init(void) static int raiden_debug_spi_init(void)
{ {
struct usb_match match; struct usb_match match;
char *serial = extract_programmer_param("serial"); char *serial = extract_programmer_param("serial");
@ -1617,3 +1617,13 @@ loop_end:
return 0; return 0;
} }
const struct programmer_entry programmer_raiden_debug_spi = {
.name = "raiden_debug_spi",
.type = USB,
.devs.dev = devs_raiden,
.init = raiden_debug_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -236,7 +236,7 @@ static const struct bitbang_spi_master bitbang_spi_master_rayer = {
.half_period = 0, .half_period = 0,
}; };
int rayer_spi_init(void) static int rayer_spi_init(void)
{ {
const struct rayer_programmer *prog = rayer_spi_types; const struct rayer_programmer *prog = rayer_spi_types;
char *arg = NULL; char *arg = NULL;
@ -324,6 +324,17 @@ int rayer_spi_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_rayer_spi = {
.name = "rayer_spi",
.type = OTHER,
/* FIXME */
.devs.note = "RayeR parallel port programmer\n",
.init = rayer_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#else #else
#error PCI port I/O access is not supported on this architecture yet. #error PCI port I/O access is not supported on this architecture yet.
#endif #endif

View File

@ -480,7 +480,7 @@ static int get_params(int *reset, int *enter_isp)
return ret; return ret;
} }
int realtek_mst_i2c_spi_init(void) static int realtek_mst_i2c_spi_init(void)
{ {
int ret = 0; int ret = 0;
int reset = 0, enter_isp = 0; int reset = 0, enter_isp = 0;
@ -517,3 +517,13 @@ int realtek_mst_i2c_spi_init(void)
return ret; return ret;
} }
const struct programmer_entry programmer_realtek_mst_i2c_spi = {
.name = "realtek_mst_i2c_spi",
.type = OTHER,
.devs.note = "Device files /dev/i2c-*.\n",
.init = realtek_mst_i2c_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -25,7 +25,7 @@
static uint8_t *mv_bar; static uint8_t *mv_bar;
static uint16_t mv_iobar; static uint16_t mv_iobar;
const struct dev_entry satas_mv[] = { static const struct dev_entry satas_mv[] = {
/* 88SX6041 and 88SX6042 are the same according to the datasheet. */ /* 88SX6041 and 88SX6042 are the same according to the datasheet. */
{0x11ab, 0x7042, OK, "Marvell", "88SX7042 PCI-e 4-port SATA-II"}, {0x11ab, 0x7042, OK, "Marvell", "88SX7042 PCI-e 4-port SATA-II"},
@ -100,7 +100,7 @@ static const struct par_master par_master_satamv = {
* 0xc08 PCI BAR2 (Flash/NVRAM) Control * 0xc08 PCI BAR2 (Flash/NVRAM) Control
* 0x1046c Flash Parameters * 0x1046c Flash Parameters
*/ */
int satamv_init(void) static int satamv_init(void)
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
uintptr_t addr; uintptr_t addr;
@ -184,6 +184,16 @@ int satamv_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_satamv = {
.name = "satamv",
.type = PCI,
.devs.dev = satas_mv,
.init = satamv_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#else #else
#error PCI port I/O access is not supported on this architecture yet. #error PCI port I/O access is not supported on this architecture yet.
#endif #endif

View File

@ -26,7 +26,7 @@
static uint8_t *sii_bar; static uint8_t *sii_bar;
static uint16_t id; static uint16_t id;
const struct dev_entry satas_sii[] = { static const struct dev_entry satas_sii[] = {
{0x1095, 0x0680, OK, "Silicon Image", "PCI0680 Ultra ATA-133 Host Ctrl"}, {0x1095, 0x0680, OK, "Silicon Image", "PCI0680 Ultra ATA-133 Host Ctrl"},
{0x1095, 0x3112, OK, "Silicon Image", "SiI 3112 [SATALink/SATARaid] SATA Ctrl"}, {0x1095, 0x3112, OK, "Silicon Image", "SiI 3112 [SATALink/SATARaid] SATA Ctrl"},
{0x1095, 0x3114, OK, "Silicon Image", "SiI 3114 [SATALink/SATARaid] SATA Ctrl"}, {0x1095, 0x3114, OK, "Silicon Image", "SiI 3114 [SATALink/SATARaid] SATA Ctrl"},
@ -93,7 +93,7 @@ static const struct par_master par_master_satasii = {
.chip_writen = fallback_chip_writen, .chip_writen = fallback_chip_writen,
}; };
int satasii_init(void) static int satasii_init(void)
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
uint32_t addr; uint32_t addr;
@ -133,3 +133,12 @@ int satasii_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_satasii = {
.name = "satasii",
.type = PCI,
.devs.dev = satas_sii,
.init = satasii_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -539,7 +539,7 @@ static int serprog_shutdown(void *data)
static enum chipbustype serprog_buses_supported = BUS_NONE; static enum chipbustype serprog_buses_supported = BUS_NONE;
int serprog_init(void) static int serprog_init(void)
{ {
uint16_t iface; uint16_t iface;
unsigned char pgmname[17]; unsigned char pgmname[17];
@ -898,7 +898,7 @@ init_err_cleanup_exit:
return 1; return 1;
} }
void serprog_delay(unsigned int usecs) static void serprog_delay(unsigned int usecs)
{ {
unsigned char buf[4]; unsigned char buf[4];
msg_pspew("%s usecs=%d\n", __func__, usecs); msg_pspew("%s usecs=%d\n", __func__, usecs);
@ -919,7 +919,7 @@ void serprog_delay(unsigned int usecs)
sp_prev_was_write = 0; sp_prev_was_write = 0;
} }
void *serprog_map(const char *descr, uintptr_t phys_addr, size_t len) static void *serprog_map(const char *descr, uintptr_t phys_addr, size_t len)
{ {
/* Serprog transmits 24 bits only and assumes the underlying implementation handles any remaining bits /* Serprog transmits 24 bits only and assumes the underlying implementation handles any remaining bits
* correctly (usually setting them to one either in software (for FWH/LPC) or relying on the fact that * correctly (usually setting them to one either in software (for FWH/LPC) or relying on the fact that
@ -933,3 +933,14 @@ void *serprog_map(const char *descr, uintptr_t phys_addr, size_t len)
descr, len, PRIxPTR_WIDTH, phys_addr); descr, len, PRIxPTR_WIDTH, phys_addr);
return NULL; return NULL;
} }
const struct programmer_entry programmer_serprog = {
.name = "serprog",
.type = OTHER,
/* FIXME */
.devs.note = "All programmer devices speaking the serprog protocol\n",
.init = serprog_init,
.map_flash_region = serprog_map,
.unmap_flash_region = fallback_unmap,
.delay = serprog_delay,
};

View File

@ -114,7 +114,7 @@ enum spi_nss_level {
#define USB_TIMEOUT_IN_MS 5000 #define USB_TIMEOUT_IN_MS 5000
const struct dev_entry devs_stlinkv3_spi[] = { static const struct dev_entry devs_stlinkv3_spi[] = {
{0x0483, 0x374F, OK, "STMicroelectronics", "STLINK-V3"}, {0x0483, 0x374F, OK, "STMicroelectronics", "STLINK-V3"},
{0} {0}
}; };
@ -469,7 +469,7 @@ static const struct spi_master spi_programmer_stlinkv3 = {
.write_aai = default_spi_write_aai, .write_aai = default_spi_write_aai,
}; };
int stlinkv3_spi_init(void) static int stlinkv3_spi_init(void)
{ {
uint16_t sck_freq_kHz = 1000; // selecting 1 MHz SCK is a good bet uint16_t sck_freq_kHz = 1000; // selecting 1 MHz SCK is a good bet
char *speed_str = NULL; char *speed_str = NULL;
@ -549,3 +549,13 @@ init_err_exit:
libusb_exit(usb_ctx); libusb_exit(usb_ctx);
return ret; return ret;
} }
const struct programmer_entry programmer_stlinkv3_spi = {
.name = "stlinkv3_spi",
.type = USB,
.devs.dev = devs_stlinkv3_spi,
.init = stlinkv3_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};

View File

@ -45,7 +45,7 @@
#define ALTERA_VID 0x09fb #define ALTERA_VID 0x09fb
#define ALTERA_USBBLASTER_PID 0x6001 #define ALTERA_USBBLASTER_PID 0x6001
const struct dev_entry devs_usbblasterspi[] = { static const struct dev_entry devs_usbblasterspi[] = {
{ALTERA_VID, ALTERA_USBBLASTER_PID, OK, "Altera", "USB-Blaster"}, {ALTERA_VID, ALTERA_USBBLASTER_PID, OK, "Altera", "USB-Blaster"},
{0} {0}
@ -177,7 +177,7 @@ static const struct spi_master spi_master_usbblaster = {
}; };
/* Returns 0 upon success, a negative number upon errors. */ /* Returns 0 upon success, a negative number upon errors. */
int usbblaster_spi_init(void) static int usbblaster_spi_init(void)
{ {
uint8_t buf[BUF_SIZE + 1] = { 0 }; uint8_t buf[BUF_SIZE + 1] = { 0 };
struct ftdi_context ftdic; struct ftdi_context ftdic;
@ -232,4 +232,14 @@ int usbblaster_spi_init(void)
return 0; return 0;
} }
const struct programmer_entry programmer_usbblaster_spi = {
.name = "usbblaster_spi",
.type = USB,
.devs.dev = devs_usbblasterspi,
.init = usbblaster_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
.delay = internal_delay,
};
#endif #endif