void init_STEPPERS(void) {
       // set the stepper STEP and DIR pins to GPIO output 4ma 3.3v
       HW_PINCTRL_MUXSEL0_SET(MUX0_PINS);
       HW_PINCTRL_MUXSEL1_SET(MUX1_PINS); 
       HW_PINCTRL_DRIVE0_CLR(DRIVE0_MA_PINS);
       HW_PINCTRL_DRIVE2_CLR(DRIVE2_MA_PINS);
       HW_PINCTRL_DRIVE3_CLR(DRIVE3_MA_PINS);
       HW_PINCTRL_DRIVE0_SET(DRIVE0_V_PINS);
       HW_PINCTRL_DRIVE2_SET(DRIVE2_V_PINS);
       HW_PINCTRL_DRIVE3_SET(DRIVE3_V_PINS);
       HW_PINCTRL_DOUT0_CLR(STEP_PINS | DIR_PINS);
       HW_PINCTRL_DOE3_SET(STEP_PINS | DIR_PINS);
}
void init_SPI_PINS(void) {

// select the pins we need as GPIO
        HW_PINCTRL_MUXSEL1_SET(MOSI_MUX | SCK_MUX | RCK32_MUX | RCK16_MUX);
// set the drive current
        HW_PINCTRL_DRIVE3_CLR(MOSI_MA | SCK_MA | RCK32_MA);
        HW_PINCTRL_DRIVE2_CLR(RCK16_MA);
//set the drive voltage
        HW_PINCTRL_DRIVE3_SET(MOSI_V | SCK_V | RCK32_V);
        HW_PINCTRL_DRIVE2_SET(RCK16_V);
       
// set the pins as outputs and set the initial values to zero
        HW_PINCTRL_DOUT0_CLR(MOSI_PIN|SCK_PIN|RCK32_PIN|RCK16_PIN);
// enable the pins
        HW_PINCTRL_DOE0_SET(MOSI_PIN|SCK_PIN|RCK32_PIN|RCK16_PIN);
}
Example #3
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;
}