// ============================================================================ // fPowerCycleInitializeTargetForISSP() // Implements the intialization vectors for the device. // The first time fDetectHiLoTransition is called the Clk pin is highZ because // the clock is not needed during acquire. // Returns: // 0 if successful // INIT_ERROR if timed out on handshake to the device. // ============================================================================ signed char fPowerCycleInitializeTargetForISSP(unsigned long flag) { int n; printk(KERN_ERR"[TOUCHKEY]start fPowerCycleInitializeTargetForISSP\n"); // Set all pins to highZ to avoid back powering the PSoC through the GPIO // protection diodes. SetSCLKHiZ(); SetSDATAHiZ(); // Turn on power to the target device before other signals SetTargetVDDStrong(); ApplyTargetVDD(); local_irq_save(flag); // wait 1msec for the power to stabilize //#if 0 for (n = 0; n < 10; n++) { Delay(DELAY100us); } //#endif // Set SCLK to high Z so there is no clock and wait for a high to low // transition on SDAT. SCLK is not needed this time. SetSCLKHiZ(); // printk(KERN_DEBUG "fDetectHiLoTransition\n"); if ((fIsError = fDetectHiLoTransition())) { #if defined(CONFIG_TARGET_LOCALE_NAATT) local_irq_restore(flag); #endif printk(KERN_ERR"[TOUCHKEY]fDetectHiLoTransition()error!!!\n"); return (INIT_ERROR); } // Configure the pins for initialization // SetSDATAHiZ(); // issp_test_20100709 block SetSCLKStrong(); SCLKLow(); //PTJ: DO NOT SET A BREAKPOINT HERE AND EXPECT SILICON ID TO PASS! // !!! NOTE: // The timing spec that requires that the first Init-Vector happen within // 1 msec after the reset/power up. For this reason, it is not advisable // to separate the above RESET_MODE or POWER_CYCLE_MODE code from the // Init-Vector instructions below. Doing so could introduce excess delay // and cause the target device to exit ISSP Mode. SendVector(wait_and_poll_end, num_bits_wait_and_poll_end); //PTJ: rev308, added to match spec // printk("SendVector(id_setup_1)\n",0,0,0); SendVector(id_setup_1, num_bits_id_setup_1); if ((fIsError = fDetectHiLoTransition())) { #if defined(CONFIG_TARGET_LOCALE_NAATT) local_irq_restore(flag); #endif printk(KERN_ERR"[TOUCHKEY]fDetectHiLoTransition()error!!!\n"); return (INIT_ERROR); } SendVector(wait_and_poll_end, num_bits_wait_and_poll_end); // NOTE: DO NOT not wait for HiLo on SDATA after vector Init-3 // it does not occur (per spec). return (PASS); }
// ============================================================================ // fPowerCycleInitializeTargetForISSP() // Implements the intialization vectors for the device. // The first time fDetectHiLoTransition is called the Clk pin is highZ because // the clock is not needed during acquire. // Returns: // 0 if successful // INIT_ERROR if timed out on handshake to the device. // ============================================================================ signed char fPowerCycleInitializeTargetForISSP(void) { unsigned char n; unsigned long flags; // Set all pins to highZ to avoid back powering the PSoC through the GPIO // protection diodes. SetSCLKHiZ(); SetSDATAHiZ(); // Turn on power to the target device before other signals SetTargetVDDStrong(); // lock interrupts for accurate timing local_irq_save(flags); ApplyTargetVDD(); // wait 1msec for the power to stabilize #if 1 //etinum.LJ.firmware_update Delay(1000); #else for (n=0; n<10; n++) { Delay(DELAY100us/3); } #endif // Set SCLK to high Z so there is no clock and wait for a high to low // transition on SDAT. SCLK is not needed this time. SetSCLKHiZ(); local_irq_restore(flags); if (fIsError = fDetectHiLoTransition()) { return(INIT_ERROR); } printk(KERN_ERR "[CYPRESS] step1 passed\n"); // Configure the pins for initialization SetSDATAHiZ(); SetSCLKStrong(); SCLKLow(); //PTJ: DO NOT SET A BREAKPOINT HERE AND EXPECT SILICON ID TO PASS! // !!! NOTE: // The timing spec that requires that the first Init-Vector happen within // 1 msec after the reset/power up. For this reason, it is not advisable // to separate the above RESET_MODE or POWER_CYCLE_MODE code from the // Init-Vector instructions below. Doing so could introduce excess delay // and cause the target device to exit ISSP Mode. SendVector(id_setup_1, num_bits_id_setup_1); if (fIsError = fDetectHiLoTransition()) { return(INIT_ERROR); } SendVector(wait_and_poll_end, num_bits_wait_and_poll_end); printk(KERN_ERR "[CYPRESS] step2 passed\n"); // NOTE: DO NOT not wait for HiLo on SDATA after vector Init-3 // it does not occur (per spec). return(PASS); }
// ============================================================================ // fPowerCycleInitializeTargetForISSP() // Implements the intialization vectors for the device. // The first time fDetectHiLoTransition is called the Clk pin is highZ because // the clock is not needed during acquire. // Returns: // 0 if successful // INIT_ERROR if timed out on handshake to the device. // ============================================================================ signed char fPowerCycleInitializeTargetForISSP(void) { // unsigned char n; // Set all pins to highZ to avoid back powering the PSoC through the GPIO // protection diodes. SetSCLKHiZ(); SetSDATAHiZ(); // Turn on power to the target device before other signals SetTargetVDDStrong(); RemoveTargetVDD(); mdelay(5); ApplyTargetVDD(); // wait 1msec for the power to stabilize mdelay(1); // Set SCLK to high Z so there is no clock and wait for a high to low // transition on SDAT. SCLK is not needed this time. SetSCLKHiZ(); fIsError = fDetectHiLoTransition(); if ( fIsError ) { printk(KERN_INFO "[TSP] %s, %d\n", __func__, __LINE__); return(INIT_ERROR); } // Configure the pins for initialization SetSDATAHiZ(); SetSCLKStrong(); SCLKLow(); //PTJ: DO NOT SET A BREAKPOINT HERE AND EXPECT SILICON ID TO PASS! // !!! NOTE: // The timing spec that requires that the first Init-Vector happen within // 1 msec after the reset/power up. For this reason, it is not advisable // to separate the above RESET_MODE or POWER_CYCLE_MODE code from the // Init-Vector instructions below. Doing so could introduce excess delay // and cause the target device to exit ISSP Mode. SendVector(id_setup_1, num_bits_id_setup_1); fIsError = fDetectHiLoTransition(); if ( fIsError ) { printk(KERN_INFO "[TSP] %s, %d\n", __func__, __LINE__); return(INIT_ERROR); } SendVector(wait_and_poll_end, num_bits_wait_and_poll_end); // NOTE: DO NOT not wait for HiLo on SDATA after vector Init-3 // it does not occur (per spec). return(PASS); }
// ============================================================================ // ReStartTarget() // After programming, the target PSoC must be reset to take it out of // programming mode. This routine performs a reset. // ============================================================================ void ReStartTarget(void) { #ifdef RESET_MODE // Assert XRES, then release, then disable XRES-Enable AssertXRES(); Delay(XRES_CLK_DELAY); DeassertXRES(); #else // Set all pins to highZ to avoid back powering the PSoC through the GPIO // protection diodes. SetSCLKHiZ(); SetSDATAHiZ(); // Cycle power on the target to cause a reset RemoveTargetVDD(); mdelay(300); ApplyTargetVDD(); #endif }
/* ============================================================================ // ReStartTarget() // After programming, the target PSoC must be reset to take it out of // programming mode. This routine performs a reset. ============================================================================*/ void ReStartTarget(void) { #ifdef RESET_MODE /* Assert XRES, then release, then disable XRES-Enable */ AssertXRES(); udelay(XRES_CLK_DELAY); DeassertXRES(); #else /* Set all pins to highZ to avoid back powering the PSoC through the GPIO */ /* protection diodes. */ SetSCLKHiZ(); SetSDATAHiZ(); /* Cycle power on the target to cause a reset */ RemoveTargetVDD(); udelay(POWER_CYCLE_DELAY); ApplyTargetVDD(); #endif }
void ReStartTarget(void) { //int i; #ifdef RESET_MODE /* Assert XRES, then release, then disable XRES-Enable */ AssertXRES(); Delay(XRES_CLK_DELAY); DeassertXRES(); #else /* Set all pins to highZ to avoid back powering the PSoC through the GPIO protection diodes. */ SetSCLKHiZ(); SetSDATAHiZ(); /* Cycle power on the target to cause a reset */ RemoveTargetVDD(); // jjlee for (i = 0; i < 100; i++) Delay(50000); ApplyTargetVDD(); #endif }
/* ============================================================================ fPowerCycleInitializeTargetForISSP() Implements the intialization vectors for the device. The first time fDetectHiLoTransition is called the Clk pin is highZ because the clock is not needed during acquire. Returns: 0 if successful INIT_ERROR if timed out on handshake to the device. ============================================================================ */ signed char fPowerCycleInitializeTargetForISSP(void) { unsigned char n; /* Set all pins to highZ to avoid back powering the PSoC through the GPIO protection diodes. */ SetSCLKHiZ(); SetSDATAHiZ(); /* Turn on power to the target device before other signals */ SetTargetVDDStrong(); for (n = 0; n < 100; n++) Delay(50000); ApplyTargetVDD(); /* wait 1msec for the power to stabilize */ for (n = 0; n < 10; n++) Delay(DELAY100us); /* Set SCLK to high Z so there is no clock and wait for a high to low transition on SDAT. SCLK is not needed this time. */ SetSCLKHiZ(); fIsError = fDetectHiLoTransition(); if (fIsError != 0) return INIT_ERROR; /*Configure the pins for initialization */ SetSDATAHiZ(); SetSCLKStrong(); SCLKLow(); /*PTJ: DO NOT SET A BREAKPOINT HERE AND EXPECT SILICON ID TO PASS! !!! NOTE: The timing spec that requires that the first Init-Vector happen within 1 msec after the reset/power up. For this reason, it is not advisable to separate the above RESET_MODE or POWER_CYCLE_MODE code from the Init-Vector instructions below. Doing so could introduce excess delay and cause the target device to exit ISSP Mode. */ SendVector(wait_and_poll_end, num_bits_wait_and_poll_end); /*20100114 KJHW(Jason) : 0114 by KJHW */ SendVector(id_setup_1, num_bits_id_setup_1); fIsError = fDetectHiLoTransition(); if (fIsError != 0) return INIT_ERROR; SendVector(wait_and_poll_end, num_bits_wait_and_poll_end); /* NOTE: DO NOT not wait for HiLo on SDATA after vector Init-3 it does not occur (per spec). */ return PASS; }
/* ============================================================================ // fPowerCycleInitializeTargetForISSP() // Implements the intialization vectors for the device. // The first time fDetectHiLoTransition is called the Clk pin is highZ because // the clock is not needed during acquire. // Returns: // 0 if successful // INIT_ERROR if timed out on handshake to the device. ============================================================================*/ signed char fPowerCycleInitializeTargetForISSP(void) { unsigned char n; SetSDATALow(); SCLKLow(); RemoveTargetVDD(); mdelay(500); SetSCLKHiZ(); SetSDATAHiZ(); /* Set all pins to highZ to avoid back powering the PSoC through the GPIO // protection diodes. */ /* Turn on power to the target device before other signals */ SetTargetVDDStrong(); ApplyTargetVDD(); /* wait 1msec for the power to stabilize */ for (n = 0; n < 10; n++) udelay(DELAY100us); /* Set SCLK to high Z so there is no clock and wait for a high to low // transition on SDAT. SCLK is not needed this time. */ SetSCLKHiZ(); mdelay(10); /* //fIsError = fDetectHiLoTransition(); //if (fIsError ) { //printk("wly: fDetectHiLoTransition 11111 failed!\n"); //return(INIT_ERROR); //} */ /* Configure the pins for initialization */ SetSDATAHiZ(); SetSCLKStrong(); SCLKLow(); /* DO NOT SET A BREAKPOINT HERE AND EXPECT SILICON ID TO PASS! */ /* !!! NOTE: // The timing spec that requires that the first Init-Vector happen within // 1 msec after the reset/power up. For this reason, it is not advisable // to separate the above RESET_MODE or POWER_CYCLE_MODE code from the // Init-Vector instructions below. Doing so could introduce excess delay // and cause the target device to exit ISSP Mode. */ SendVector(id_setup_1, num_bits_id_setup_1); fIsError = fDetectHiLoTransition(); if (fIsError) { pr_info("wly: fDetectHiLoTransition 222222 failed!\n"); return INIT_ERROR; } SendVector(wait_and_poll_end, num_bits_wait_and_poll_end); /* NOTE: DO NOT not wait for HiLo on SDATA after vector Init-3 // it does not occur (per spec). */ return PASS; }