void set_register(uint32_t write_pin ,uint32_t value ) {

int i;
int length;
 
       if(write_pin == RCK32_PIN){
          length = 32;
       }
       else {
          length = 16;
       }
       printf("buffer= %X\r\n",value);
       for(i=0;i<length;i++) {
           if((value >> i) & 0x00000001){ 
              HW_PINCTRL_DOUT0_SET(MOSI_PIN);
 //             printf("\n\rset");
           }
           else
           {
              HW_PINCTRL_DOUT0_CLR(MOSI_PIN);
//              printf("\n\rreset");
           }
// the 74HC595 has a max transition delay of 1000 ns.

           HW_PINCTRL_DOUT0_SET(SCK_PIN);
           udelay(1);
           HW_PINCTRL_DOUT0_CLR(SCK_PIN);
           udelay(1);
	}
Ejemplo n.º 2
0
/* called during probe() after chip reset completes */
static int ehci_fsl_setup(struct usb_hcd *hcd)
{
    struct ehci_hcd *ehci = hcd_to_ehci(hcd);
    int retval;
    struct fsl_usb2_platform_data *pdata;
    pdata = hcd->self.controller->platform_data;

    ehci->big_endian_desc = pdata->big_endian_desc;
    ehci->big_endian_mmio = pdata->big_endian_mmio;

    /* EHCI registers start at offset 0x100 */
    ehci->caps = hcd->regs + 0x100;
    ehci->regs = hcd->regs + 0x100 +
                 HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));
    dbg_hcs_params(ehci, "reset");
    dbg_hcc_params(ehci, "reset");

    /* cache this readonly data; minimize chip reads */
    ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);

    retval = ehci_halt(ehci);

    /* data structure init */
    retval = ehci_init(hcd);
    if (retval)
        return retval;

    hcd->has_tt = 1;

    ehci->sbrn = 0x20;

    ehci_reset(ehci);

    retval = ehci_fsl_reinit(ehci);


#ifdef CHUMBY_USB_MODIFICATIONS
    /* Also, disable the IRQ for the 5V line.  Turning on the screen causes
     * a massive drop in power, and the battery circuitry thinks we've
     * pulled the 5V line.
     */
    HW_POWER_CTRL_CLR(1);




    /* Wait just enough time for the brownout.  Any less than this and it
     * reboots when we bring the USB card up, or segfaults.
     */
    msleep(5);


    /* Set bank 0, pins 26 and 28 to GPIO. */
    HW_PINCTRL_MUXSEL1_SET(0x03300000);


    /* Set both pins to low, which ensures a reset takes place. */
    HW_PINCTRL_DOUT0_CLR(0x24000000);
    HW_PINCTRL_DOE0_SET(0x24000000);
    HW_PINCTRL_DOUT0_CLR(0x24000000);
    msleep(5);


    /* Delay for one second, giving most USB devices the chance to
     * recognize they've been "unplugged".
     */
    msleep(1000);


    /* Write a "1" to bank 0, pin 28. */
    HW_PINCTRL_DOUT0_SET(0x20000000);
    msleep(5);


    /* Write a "1" to bank 0, pin 26, to disable USB.  This ensures a reset.
     * Wait a short time after, then re-enable the IRQ that fires when power
     * is pulled.  This is because by now, the voltages should have
     * stabilized.
     */
    HW_PINCTRL_DOUT0_SET(0x04000000);
    msleep(5);


    /* Re-enable the power interrupt. */
    HW_POWER_CTRL_SET(1);


#endif /*CHUMBY_USB_MODIFICATIONS*/

    return retval;
}