mx23-evk: fix MCI support
Subsystems (2)
PATCH 1/3 mx23-evk: fix MCI support
- this patch fix MCI support and enable using the SDCard to store the environment.
- it is fully copied from imx23-olinuxino.c
- tested on i.MX23 EVK RevB1
--- arch/arm/boards/freescale-mx23-evk/mx23-evk.c | 54 +++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 4 deletions(-)
arch/arm/boards/freescale-mx23-evk/mx23-evk.c +50 -4
@@ -26,8 +26,9 @@#include <mach/mci.h> static struct mxs_mci_platform_data mci_pdata = { - .caps =MMC_MODE_4BIT , + .caps =MMC_MODE_4BIT |MMC_MODE_HS | MMC_MODE_HS_52MHz, .voltages =MMC_VDD_32_33 |MMC_VDD_33_34 ,/* fixed to 3.3 V */ + .f_min =400000 , };static const uint32_t pad_setup[] = {
@@ -49,9 +50,48 @@ static int mx23_evk_mem_init(void) }mem_initcall (mx23_evk_mem_init); +/** +* Try to register an environment storage on the attached MCI card +* @return 0 on success +* +* We rely on the existence of a usable SD card, already attached to +* our system, to get something like a persistent memory for our environment. +* If this SD card is also the boot media, we can use the second partition +* for our environment purpose (if present!). +*/ +static int register_persistant_environment (void ) +{ +struct cdev *cdev; + +/* +* The imx23-olinuxino only has one MCI card socket. +* So, we expect its name as "disk0". +*/ + cdev =cdev_by_name ("disk0" ); +if (cdev ==NULL ) { +pr_err ("No MCI card preset\n" ); +return -ENODEV ; + } + + + +/* MCI card is present, also a useable partition on it? */ + cdev =cdev_by_name ("disk0.1" ); +if (cdev ==NULL ) { +pr_err ("No second partition available\n" ); +pr_info ("Please create at least a second partition with" +" 256 kiB...512 kiB in size (your choice)\n" ); +return -ENODEV ; + } + +/* use the full partition as our persistent environment storage */ +return devfs_add_partition ("disk0.1" ,0 , cdev->size, +DEVFS_PARTITION_FIXED ,"env0" ); +} +static int mx23_evk_devices_init (void ) { -int i; +int i, rc;/* initizalize gpios */ for (i =0 ; i <ARRAY_SIZE (pad_setup); i++)
@@ -62,8 +102,14 @@ static int mx23_evk_devices_init(void)imx_set_ioclk (480000000 );/* enable IOCLK to run at the PLL frequency */ imx_set_sspclk (0 ,100000000 ,1 ); -add_generic_device ("mxs_mci" ,0 ,NULL ,IMX_SSP1_BASE ,0 , -IORESOURCE_MEM , &mci_pdata); + +add_generic_device ("mxs_mci" ,DEVICE_ID_DYNAMIC ,NULL ,IMX_SSP1_BASE , +0x8000 ,IORESOURCE_MEM , &mci_pdata); + + rc =register_persistant_environment (); +if (rc !=0 ) +printf ("Cannot create the 'env0' persistant " +"environment storage (%d)\n" , rc);return 0 ; }
Signature · 7 lines
1.7.11.7 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/3 mx23-evk: add USB gadget support
- enable the USB OTG device in gadget mode
- tested on i.MX23 EVH rev B1 with DFU
--- arch/arm/boards/freescale-mx23-evk/mx23-evk.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/arm/boards/freescale-mx23-evk/mx23-evk.c +15 -0
@@ -24,6 +24,8 @@#include <mach/imx-regs.h> #include <mach/clock.h> #include <mach/mci.h> +#include <usb/fsl_usb2.h> +#include <mach/usb.h> static struct mxs_mci_platform_data mci_pdata = { .caps =MMC_MODE_4BIT |MMC_MODE_HS | MMC_MODE_HS_52MHz,
@@ -42,6 +44,13 @@ static const uint32_t pad_setup[] = { SSP1_DETECT | PULLUP(1), }; +#ifdef CONFIG_USB_GADGET_DRIVER_ARC +static struct fsl_usb2_platform_data usb_pdata = { + .operating_mode =FSL_USB2_DR_DEVICE , + .phy_mode =FSL_USB2_PHY_UTMI , +}; +#endif +static int mx23_evk_mem_init (void ) {arm_add_mem_device ("ram0" ,IMX_MEMORY_BASE ,32 *1024 *1024 );
@@ -111,6 +120,12 @@ static int mx23_evk_devices_init(void)printf ("Cannot create the 'env0' persistant " "environment storage (%d)\n" , rc); +#ifdef CONFIG_USB_GADGET_DRIVER_ARC +imx23_usb_phy_enable (); +add_generic_usb_ehci_device (DEVICE_ID_DYNAMIC ,IMX_USB_BASE ,NULL ); +add_generic_device ("fsl-udc" ,DEVICE_ID_DYNAMIC ,NULL ,IMX_USB_BASE , +0x200 ,IORESOURCE_MEM , &usb_pdata); +#endif return 0 ; }
Signature · 7 lines
1.7.11.7 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/3 mx23-evk: update defconfig
In reply to Eric Bénard- enable USB gadget and DFU
- enable MCI and probe at boot
- enable EXT4 and FAT filesystems
--- arch/arm/configs/imx23evk_defconfig | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
arch/arm/configs/imx23evk_defconfig +13 -4
@@ -5,20 +5,29 @@ CONFIG_BROKEN=y CONFIG_LONGHELP=y CONFIG_CMDLINE_EDITING=y CONFIG_AUTO_COMPLETE=y -CONFIG_PARTITION=y -# CONFIG_DEFAULT_ENVIRONMENT is not set +CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y +CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y +CONFIG_RESET_SOURCE=y CONFIG_DEBUG_INFO=y CONFIG_CMD_EDIT=y CONFIG_CMD_SLEEP=y CONFIG_CMD_SAVEENV=y -CONFIG_CMD_LOADENV=y CONFIG_CMD_EXPORT=y CONFIG_CMD_PRINTENV=y CONFIG_CMD_READLINE=y CONFIG_CMD_ECHO_E=y +CONFIG_CMD_RESET=y CONFIG_CMD_MTEST=y CONFIG_CMD_MTEST_ALTERNATIVE=y -CONFIG_CMD_RESET=y CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y # CONFIG_SPI is not set +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DFU=y +CONFIG_MCI=y +CONFIG_MCI_STARTUP=y +CONFIG_MCI_MXS=y +CONFIG_FS_EXT4=y +CONFIG_FS_FAT=y +CONFIG_FS_FAT_WRITE=y +CONFIG_FS_FAT_LFN=y
Signature · 7 lines
1.7.11.7 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerQuoted 6 lines · Eric Bénard
- this patch fix MCI support and enable using the SDCard to store the environment.
- it is fully copied fromimx23-olinuxino.c
- tested on i.MX23 EVK RevB1Signed-off-by Eric Bénard <[email protected]>
Applied this series.
BTW you might have noticed that I added support for a i.MX specific chipidea driver. This is currently used on traditional i.MX only, but could be extended for the i.MX23/28 aswell.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox