Skip to content
Snippets Groups Projects
cmd_pcmcia.c 73.8 KiB
Newer Older
  • Learn to ignore specific revisions
  • 		" Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
    		'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
    
    	immap = (immap_t *)CFG_IMMR;
    	cp    = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
    	pcmp  = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
    	/*
    	 * Disable PCMCIA buffers (isolate the interface)
    	 * and assert RESET signal
    	 */
    	debug ("Disable PCMCIA buffers and assert RESET\n");
    	reg  = PCMCIA_PGCRX(_slot_);
    	reg |= __MY_PCMCIA_GCRX_CXRESET;	/* active high */
    	reg |= __MY_PCMCIA_GCRX_CXOE;		/* active low  */
    	PCMCIA_PGCRX(_slot_) = reg;
    	udelay(500);
    
    	/*
    	 * Configure Port C pins for
    	 * 5 Volts Enable and 3 Volts enable,
    	 * Turn all power pins to Hi-Z
    	 */
    	debug ("PCMCIA power OFF\n");
    	cfg_ports ();	/* Enables switch, but all in Hi-Z */
    
    	sreg  = immap->im_ioport.iop_pcdat;
    	set_vppd(0, 1); set_vppd(1, 1);
    
    	switch(vcc) {
    	case  0:
    		break;	/* Switch off		*/
    
    	case 33:
    		set_vccd(0, 1); set_vccd(1, 0);
    		break;
    
    	case 50:
    		set_vccd(0, 0); set_vccd(1, 1);
    		break;
    
    	default:
    		goto done;
    	}
    
    	/* Checking supported voltages */
    
    	debug ("PIPR: 0x%x --> %s\n",
    		pcmp->pcmc_pipr,
    		(pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
    
    done:
    	debug ("Enable PCMCIA buffers and stop RESET\n");
    	reg  =  PCMCIA_PGCRX(_slot_);
    	reg &= ~__MY_PCMCIA_GCRX_CXRESET;	/* active high */
    	reg &= ~__MY_PCMCIA_GCRX_CXOE;		/* active low  */
    	PCMCIA_PGCRX(_slot_) = reg;
    	udelay(500);
    
    	debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
    		slot+'A');
    	return (0);
    }
    
    static void cfg_ports (void)
    {
    	volatile immap_t	*immap;
    	volatile cpm8xx_t	*cp;
    
    	immap = (immap_t *)CFG_IMMR;
    	cp    = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
    
    
    	cfg_vppd(0); cfg_vppd(1);	/* VPPD0,VPPD1 VAVPP => Hi-Z */
    	cfg_vccd(0); cfg_vccd(1);	/* 3V and 5V off */
    	cfg_shdn();
    	cfg_oc();
    
    	/*
    	 * Configure Port A for TPS2211 PC-Card Power-Interface Switch
    	 *
    	 * Switch off all voltages, assert shutdown
    	 */
    	set_vppd(0, 1); set_vppd(1, 1);
    	set_vccd(0, 0); set_vccd(1, 0);
    	set_shdn(1);
    
    	udelay(100000);
    }
    
    #endif	/* NETTA */
    
    
    
    /* -------------------------------------------------------------------- */
    
    Wolfgang Denk's avatar
    Wolfgang Denk committed
    
    #endif /* CFG_CMD_PCMCIA || (CFG_CMD_IDE && CONFIG_IDE_8xx_PCCARD) */
    
    Wolfgang Denk's avatar
    Wolfgang Denk committed
    
    /**************************************************/
    
    #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
    
    U_BOOT_CMD(
    	pinit,	2,	1,	do_pinit,
    
    Wolfgang Denk's avatar
    Wolfgang Denk committed
    	"pinit   - PCMCIA sub-system\n",
    	"on  - power on PCMCIA socket\n"
    	"pinit off - power off PCMCIA socket\n"
    );
    #endif