From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx2.rafi.de ([178.15.151.13]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SxCtz-0002tS-OS for barebox@lists.infradead.org; Fri, 03 Aug 2012 08:06:32 +0000 MIME-Version: 1.0 Message-ID: From: christian.buettner@rafi.de Date: Fri, 3 Aug 2012 10:06:28 +0200 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============0772411946653200073==" Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: boot init code depending on i2c eeprom value To: barebox@lists.infradead.org Dies ist eine mehrteilige Nachricht im MIME-Format. --===============0772411946653200073== Content-Type: multipart/alternative; boundary="=_alternative 002C8997C1257A4F_=" Dies ist eine mehrteilige Nachricht im MIME-Format. --=_alternative 002C8997C1257A4F_= Content-Type: text/plain; charset="US-ASCII" Hi all, i need to set the pin-mux of the board init code depending on an ID coming from an i2C EEPROM of the board. Is it possible to do something like this: ... //Using the e.g. the postcore_initcall phase to init i2C static int ecuv6_postcore_init(void) { //Set I2C EEPROM (24C32R) PIN MUX mxc_iomux_v3_setup_multiple_pads(i2c_eeprom_pads, ARRAY_SIZE(i2c_eeprom_pads)); imx53_add_i2c2(NULL); return 0; } postcore_initcall(ecuv6_postcore_init); //In the console_initcall phase, i2C should be probed to read ID static int ecuv6_console_init(void) { imx53_init_lowlevel(0); ecuv6_set_system_serial(); //get_bb_pcb_number reads data from char bb_ID; bb_ID = get_i2c_ID(); //Set Pinmux depending on i2C result if(bb_ID = 0xAB) { mxc_iomux_v3_setup_multiple_pads(AB_pads, ARRAY_SIZE( AB_pads)); } else if(bb_ID = 0xCD) { mxc_iomux_v3_setup_multiple_pads(CD_pads, ARRAY_SIZE( CD_pads)); } imx53_add_uart0(); return 0; } console_initcall(ecuv6_console_init); ... Actually this is not working. The i2c_imx:i2c_imx_probe(..) function gets called later. Is there a way or concept to do something like this? christian --=_alternative 002C8997C1257A4F_= Content-Type: text/html; charset="US-ASCII" Hi all,

i need to set the pin-mux of the board init code depending on an ID coming from
an i2C EEPROM of the board.
Is it possible to do something like this:


...

//Using the e.g. the postcore_initcall phase to init i2C
static int
ecuv6_postcore_init(void)
{
        //Set I2C EEPROM (24C32R) PIN MUX
        mxc_iomux_v3_setup_multiple_pads(i2c_eeprom_pads, ARRAY_SIZE(i2c_eeprom_pads));
        imx53_add_i2c2(NULL);
        return 0;
}
postcore_initcall(ecuv6_postcore_init);

//In the console_initcall phase, i2C should be probed to read ID
static int
ecuv6_console_init(void)
{
        imx53_init_lowlevel(0);
        ecuv6_set_system_serial();
           
        //get_bb_pcb_number reads data from
        char bb_ID;
        bb_ID = get_i2c_ID();

        //Set Pinmux depending on i2C result
        if(bb_ID = 0xAB) {
                mxc_iomux_v3_setup_multiple_pads(AB_pads, ARRAY_SIZE(AB_pads));
        }
        else if(bb_ID = 0xCD) {
                mxc_iomux_v3_setup_multiple_pads(CD_pads, ARRAY_SIZE(CD_pads));
        }
       
        imx53_add_uart0();

        return 0;
}
console_initcall(ecuv6_console_init);

...


Actually this is not working. The i2c_imx:i2c_imx_probe(..) function gets called later.
Is there a way or concept to do something like this?

christian --=_alternative 002C8997C1257A4F_=-- --===============0772411946653200073== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox --===============0772411946653200073==--