Commit f31fe841 authored by Stefan Tauner's avatar Stefan Tauner

pickit2_spi: use ordinary USB devs array

Even though there is currently only one USB device ID in the wild using our
standard way to define the devices creates nicer output for -L and -z.

Corresponding to flashrom svn r1941.
Signed-off-by: default avatarStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: default avatarCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
parent 2a0feae6
...@@ -382,9 +382,8 @@ const struct programmer_entry programmer_table[] = { ...@@ -382,9 +382,8 @@ const struct programmer_entry programmer_table[] = {
#if CONFIG_PICKIT2_SPI == 1 #if CONFIG_PICKIT2_SPI == 1
{ {
.name = "pickit2_spi", .name = "pickit2_spi",
.type = OTHER, .type = USB,
/* FIXME */ .devs.dev = devs_pickit2_spi,
.devs.note = "Microchip PICkit2\n",
.init = pickit2_spi_init, .init = pickit2_spi_init,
.map_flash_region = fallback_map, .map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap, .unmap_flash_region = fallback_unmap,
......
...@@ -55,6 +55,12 @@ ...@@ -55,6 +55,12 @@
#include "programmer.h" #include "programmer.h"
#include "spi.h" #include "spi.h"
const struct dev_entry devs_pickit2_spi[] = {
{0x04D8, 0x0033, OK, "Microchip", "PICkit 2"},
{}
};
static usb_dev_handle *pickit2_handle; static usb_dev_handle *pickit2_handle;
/* Default USB transaction timeout in ms */ /* Default USB transaction timeout in ms */
...@@ -64,9 +70,6 @@ static usb_dev_handle *pickit2_handle; ...@@ -64,9 +70,6 @@ static usb_dev_handle *pickit2_handle;
#define ENDPOINT_OUT 0x01 #define ENDPOINT_OUT 0x01
#define ENDPOINT_IN 0x81 #define ENDPOINT_IN 0x81
#define PICKIT2_VID 0x04D8
#define PICKIT2_PID 0x0033
#define CMD_GET_VERSION 0x76 #define CMD_GET_VERSION 0x76
#define CMD_SET_VDD 0xA0 #define CMD_SET_VDD 0xA0
#define CMD_SET_VPP 0xA1 #define CMD_SET_VPP 0xA1
...@@ -448,7 +451,9 @@ int pickit2_spi_init(void) ...@@ -448,7 +451,9 @@ int pickit2_spi_init(void)
usb_init(); usb_init();
(void)usb_find_busses(); (void)usb_find_busses();
(void)usb_find_devices(); (void)usb_find_devices();
struct usb_device *dev = get_device_by_vid_pid(PICKIT2_VID, PICKIT2_PID, usedevice); const uint16_t vid = devs_pickit2_spi[0].vendor_id;
const uint16_t pid = devs_pickit2_spi[0].device_id;
struct usb_device *dev = get_device_by_vid_pid(vid, pid, usedevice);
if (dev == NULL) { if (dev == NULL) {
msg_perr("Could not find a PICkit2 on USB!\n"); msg_perr("Could not find a PICkit2 on USB!\n");
return 1; return 1;
......
...@@ -499,6 +499,7 @@ int mstarddc_spi_init(void); ...@@ -499,6 +499,7 @@ int mstarddc_spi_init(void);
/* pickit2_spi.c */ /* pickit2_spi.c */
#if CONFIG_PICKIT2_SPI == 1 #if CONFIG_PICKIT2_SPI == 1
int pickit2_spi_init(void); int pickit2_spi_init(void);
extern const struct dev_entry devs_pickit2_spi[];
#endif #endif
/* rayer_spi.c */ /* rayer_spi.c */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment