colognechip integration: initial commit

This commit adds support for the Cologne Chip GateMate FPGA series. Both
Evaluation Board and Programmer Cable are supported. Configurations can be
loaded into the FPGA with both devices via JTAG or SPI. In addition to
reading/writing data from/to flashes directly via SPI, this can also be done
via the built-in JTAG-SPI-bypass. A direct wiring between programming hardware
and flash is no longer necessary in this case.

Signed-off-by: Patrick Urban <[email protected]>
This commit is contained in:
Patrick Urban
2021-12-10 12:12:32 +01:00
parent e182a53659
commit d09e5da0ba
13 changed files with 672 additions and 3 deletions
+61
View File
@@ -0,0 +1,61 @@
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright (C) 2021 Gwenhael Goavec-Merou <[email protected]>
* Copyright (C) 2021 Cologne Chip AG <[email protected]>
*/
#ifndef SRC_COLOGNECHIP_HPP_
#define SRC_COLOGNECHIP_HPP_
#include <unistd.h>
#include <regex>
#include "device.hpp"
#include "jtag.hpp"
#include "ftdispi.hpp"
#include "ftdiJtagMPSSE.hpp"
#include "rawParser.hpp"
#include "colognechipCfgParser.hpp"
#include "spiFlash.hpp"
class CologneChip: public Device, SPIInterface {
public:
CologneChip(FtdiSpi *spi, const std::string &filename,
const std::string &file_type, Device::prog_type_t prg_type,
uint16_t rstn_pin, uint16_t done_pin, uint16_t failn_pin, uint16_t oen_pin,
bool verify, int8_t verbose);
CologneChip(Jtag* jtag, const std::string &filename,
const std::string &file_type, Device::prog_type_t prg_type,
const std::string &board_name, const std::string &cable_name,
bool verify, int8_t verbose);
~CologneChip() {}
bool cfgDone();
bool dumpFlash(const std::string &filename, uint32_t base_addr, uint32_t len);
void program(unsigned int offset = 0) override;
int idCode() override {return 0;}
void reset() override;
private:
void programSPI_sram(uint8_t *data, int length);
void programSPI_flash(unsigned int offset, uint8_t *data, int length);
void programJTAG_sram(uint8_t *data, int length);
void programJTAG_flash(unsigned int offset, uint8_t *data, int length);
/* spi interface via jtag */
int spi_put(uint8_t cmd, uint8_t *tx, uint8_t *rx,
uint32_t len) override;
int spi_put(uint8_t *tx, uint8_t *rx, uint32_t len) override;
int spi_wait(uint8_t cmd, uint8_t mask, uint8_t cond, uint32_t timeout,
bool verbose=false) override;
FtdiSpi *_spi = NULL;
FtdiJtagMPSSE *_ftdi_jtag = NULL;
uint16_t _rstn_pin;
uint16_t _done_pin;
uint16_t _failn_pin;
uint16_t _oen_pin;
};
#endif // SRC_COLOGNECHIP_HPP_