2 Replies Latest reply on Aug 18, 2015 2:30 PM by plusk01

    U-Boot OTA with external SD Card

    plusk01

      I am trying to do a U-Boot OTA update from an external SD card using SparkFun's microSD block. I want to use Emutex Lab's Ubilinux, but the images are too big for the default 800MB update partition. Instead of rearranging the default partitions, I want to change the U-Boot scripts to point to mmc1 instead of mmc0 (the Edison's 4GB eMMC).

       

      I've gotten close by digging around the u-boot and linux kernel sources (after the Intel Edison Yocto patches have been applied).

       

      My progress is listed on this Gist on GitHub.

       

      I've figured out the following base memory addresses of the mmc devices:

      mmc0 = 0xff3fc000

      mmc1 = 0xff3fa000

      mmc2 = 0xff3fb000

       

      I'm quite sure that mmc2 is the bcm43340wlan chip connected through the SDIO bus.

       

      I added a sdhci initialization function for mmc1 pointing at its base address but u-boot will hang and then restart.

       

      What's odd is that if I point my new sdhci initialization function at mmc2 instead of mmc1, u-boot loads just fine and even gets some initial data from the mmc2 device, but it can't read anything. It's odd because I am fairly confident that mmc1 is the external SD card, not mmc2.

       

      Does anyone know how I can make U-Boot see my external SD card?

       

      (Note that this is different than booting from an SD card)

        • 1. Re: U-Boot OTA with external SD Card
          Intel_Peter

          Hello plusk01,

           

          This may not directly address your question, however there are  a couple of links that I think could be of help for you. I suggest you to check them:

           

          01org/edison-u-boot · GitHub

          How to boot Edison from an SD card (Linux)

           

          Nevertheless, since your question is directly related to Ubilinux, I suggest you to post your question in EmutexLabs, you might find a more accurate response there.

           

          Peter.

          • 2. Re: U-Boot OTA with external SD Card
            plusk01

            Hey Peter,

             

            Thanks for the links/info. I've reviewed a few of those things, but it seems that I'm pretty deep into the kernel and u-boot source. This Intel Forum is more aligned with what I'm talking about I think:

             

            Edison FW SFI Tables

             

            And although there is no public tool to edit SFI tables, I think what I'm trying to do can still be done. In the kernel source (after the Edison patch is applied) I find this:

             

            // ./linux/arch/x86/platform/intel-mid/device_libs/pci/platform_sdhci_pci.c

             

            /* Board specific setup related to SD goes here */

            static int mrfl_sd_setup(struct sdhci_pci_data *data)

            {

                u8 vldocnt = 0;

                int err;

             

                /*

                 * Change necessary GPIO pin mode for SD card working.

                 * This is something should be done in IA firmware.

                 * But, anyway, just do it here in case IA firmware

                 * forget to do so.

                 */

                lnw_gpio_set_alt(MRFLD_GPIO_SDIO_0_CD, 0);

             

                err = intel_scu_ipc_ioread8(MRFLD_PMIC_VLDOCNT, &vldocnt);

                if (err) {

                    pr_err("PMIC vldocnt IPC read error: %d\n", err);

                    return err;

                }

             

                vldocnt |= MRFLD_PMIC_VLDOCNT_VSWITCH_BIT;

                err = intel_scu_ipc_iowrite8(MRFLD_PMIC_VLDOCNT, vldocnt);

                if (err) {

                    pr_err("PMIC vldocnt IPC write error: %d\n", err);

                    return err;

                }

                msleep(20);

             

                return 0;

            }

             

            The comment leads me to believe that this there may be some power initialization that needs to happen before the mmc1 device can be used, but I'm not sure.

             

            Another thought that I've had is that perhaps the bcm4334xx chip is creating the SDIO bus that the eMMC and external SD card are on. The following code leads me to that thought:

            // ./linux/arch/86/platform/intel-mid/board.c

             

            struct devs_id __initconst device_ids[] = {

                /* SD devices */

                {"wl12xx_clk_vmmc", SFI_DEV_TYPE_SD, 0, &wl12xx_platform_data, NULL},

                {"bcm43xx_clk_vmmc", SFI_DEV_TYPE_SD, 0, &wifi_platform_data, NULL},

                {"bcm43xx_vmmc", SFI_DEV_TYPE_SD, 0, &wifi_platform_data, NULL},

                {"iwlwifi_clk_vmmc", SFI_DEV_TYPE_SD, 0, &wifi_platform_data, NULL},

                {"WLAN_FAST_IRQ", SFI_DEV_TYPE_SD, 0, &no_platform_data,

                 &wifi_platform_data_fastirq},

             

                /* I2C devices*/

                // ...

             

                /* SPI devices */

               // ...

                /* MSIC subdevices */

               // ...

                /* IPC devices */

               // ...

            };

             

            I'm going to try and use a logic analyzer and see if I can pull off any interesting data, but I'd love some direction if anyone has any ideas.