All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] mx23-evk: fix MCI support
@ 2013-02-10 16:22 Eric Bénard
  2013-02-10 16:22 ` [PATCH 2/3] mx23-evk: add USB gadget support Eric Bénard
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Bénard @ 2013-02-10 16:22 UTC (permalink / raw)
  To: barebox

- 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

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 arch/arm/boards/freescale-mx23-evk/mx23-evk.c | 54 +++++++++++++++++++++++++--
 1 file changed, 50 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boards/freescale-mx23-evk/mx23-evk.c b/arch/arm/boards/freescale-mx23-evk/mx23-evk.c
index 0c5fa4b..043b62b 100644
--- a/arch/arm/boards/freescale-mx23-evk/mx23-evk.c
+++ b/arch/arm/boards/freescale-mx23-evk/mx23-evk.c
@@ -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;
 }
-- 
1.7.11.7


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] mx23-evk: add USB gadget support
  2013-02-10 16:22 [PATCH 1/3] mx23-evk: fix MCI support Eric Bénard
@ 2013-02-10 16:22 ` Eric Bénard
  2013-02-10 16:22 ` [PATCH 3/3] mx23-evk: update defconfig Eric Bénard
  2013-02-11  9:31 ` [PATCH 1/3] mx23-evk: fix MCI support Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Bénard @ 2013-02-10 16:22 UTC (permalink / raw)
  To: barebox

- enable the USB OTG device in gadget mode
- tested on i.MX23 EVH rev B1 with DFU

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 arch/arm/boards/freescale-mx23-evk/mx23-evk.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/boards/freescale-mx23-evk/mx23-evk.c b/arch/arm/boards/freescale-mx23-evk/mx23-evk.c
index 043b62b..76377b1 100644
--- a/arch/arm/boards/freescale-mx23-evk/mx23-evk.c
+++ b/arch/arm/boards/freescale-mx23-evk/mx23-evk.c
@@ -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;
 }
 
-- 
1.7.11.7


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] mx23-evk: update defconfig
  2013-02-10 16:22 [PATCH 1/3] mx23-evk: fix MCI support Eric Bénard
  2013-02-10 16:22 ` [PATCH 2/3] mx23-evk: add USB gadget support Eric Bénard
@ 2013-02-10 16:22 ` Eric Bénard
  2013-02-11  9:31 ` [PATCH 1/3] mx23-evk: fix MCI support Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Bénard @ 2013-02-10 16:22 UTC (permalink / raw)
  To: barebox

- enable USB gadget and DFU
- enable MCI and probe at boot
- enable EXT4 and FAT filesystems

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 arch/arm/configs/imx23evk_defconfig | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/arch/arm/configs/imx23evk_defconfig b/arch/arm/configs/imx23evk_defconfig
index 2fc6ebe..1502d22 100644
--- a/arch/arm/configs/imx23evk_defconfig
+++ b/arch/arm/configs/imx23evk_defconfig
@@ -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
-- 
1.7.11.7


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] mx23-evk: fix MCI support
  2013-02-10 16:22 [PATCH 1/3] mx23-evk: fix MCI support Eric Bénard
  2013-02-10 16:22 ` [PATCH 2/3] mx23-evk: add USB gadget support Eric Bénard
  2013-02-10 16:22 ` [PATCH 3/3] mx23-evk: update defconfig Eric Bénard
@ 2013-02-11  9:31 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2013-02-11  9:31 UTC (permalink / raw)
  To: Eric Bénard; +Cc: barebox

On Sun, Feb 10, 2013 at 05:22:49PM +0100, Eric Bénard wrote:
> - 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
> 
> Signed-off-by: Eric Bénard <eric@eukrea.com>

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

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-11  9:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-10 16:22 [PATCH 1/3] mx23-evk: fix MCI support Eric Bénard
2013-02-10 16:22 ` [PATCH 2/3] mx23-evk: add USB gadget support Eric Bénard
2013-02-10 16:22 ` [PATCH 3/3] mx23-evk: update defconfig Eric Bénard
2013-02-11  9:31 ` [PATCH 1/3] mx23-evk: fix MCI support Sascha Hauer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.