#include "pxmcc_types.h"
#include "pxmcc_interface.h"
+#ifdef CONFIG_OC_MTD_DRV_SYSLESS
+#include <mtd_spi_drv.h>
+#endif
+
int cmd_do_test_memusage(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
{
void *maxaddr;
int cmd_do_mtdspitest(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
{
- mtd_spi_test();
+ int res;
+ unsigned char id_buff[3];
+
+ res = mtd_spi_read_jedec_id(&mtd_spi_state, id_buff, 3);
+ if (res < 0) {
+ printf("mtd_spi_read_jedec_id returned %d\n", res);
+ return -1;
+ }
+
+ printf("mtd_spi_read_jedec_id 0x%02x 0x%02x 0x%02x \n",
+ id_buff[0], id_buff[1], id_buff[2]);
+
+ res = mtd_spi_set_protect_mode(&mtd_spi_state, 0, 0);
+ if (res < 0) {
+ printf("mtd_spi_set_protect_mode returned %d\n", res);
+ return -1;
+ }
+
return 0;
}
return USB_COMPLETE_OK;
}
+int usb_spi_flash_mass_erase(int mode)
+{
+#ifdef CONFIG_OC_MTD_DRV_SYSLESS
+ mtd_spi_set_protect_mode(&mtd_spi_state, 0, 0);
+ mtd_spi_chip_erase(&mtd_spi_state, mode, 0);
+#endif /*CONFIG_KEYVAL*/
+ return 0;
+}
+
static void usb_goto(unsigned address)
{
#ifdef CONFIG_KEYVAL
usb_flash_erase((uint32_t)dreq->wValue << 10, dreq->wIndex << 10);
return 1;
+ case USB_VENDOR_MASS_ERASE:
+ usb_send_control_data(udev, NULL, 0);
+ if (dreq->wIndex == 5)
+ usb_spi_flash_mass_erase(dreq->wValue);
+ return 1;
+
case USB_VENDOR_CALL:
vendor_call_ret = SWAP(appl_usb_vendor_call(dreq->wIndex, dreq->wValue));
usb_send_control_data(udev, (unsigned char *) &vendor_call_ret, sizeof(uint16_t));