Skip to contentSkip to conversation

ARM zynq changes

PATCH New Michal Simek 1 participant 19 messages Apr 25, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover ARM zynq changes

Hi,

I am sending ARM zynq changes.
This series is based on FPGA changes I have sent
http://lists.denx.de/pipermail/u-boot/2014-April/178204.html
(There is small dependency on some patches).
My expectation is that fpga series will go to Tom's tree first.

Thanks,
Michal

Michal Simek (12):
ARM: zynq: Fix sparse warnings in slcr.c
ARM: zynq: Fix sparse warning in ddrc.c
ARM: zynq: Remove sparse warnings
ARM: zynq: Do not use half memory size for ECC case
ARM: zynq: Call zynq board_init() in SPL
ARM: zynq: slcr: Fix incorrect commentary
ARM: zynq: Setup correct slcr_lock value
ARM: zynq: Fix building SPL without FPGA support
ARM: zynq: Extend kernel image size to 60MB
ARM: zynq: Add MIO detection code
ARM: zynq: ehci: Added USB host driver support
ARM: zynq: Extend maximum number of command arguments

Mike Looijmans (1):
ARM: zynq: Fix bootmode mask

Siva Durga Prasad Paladugu (5):
ARM: zynq: Added efuse status register base address
ARM: zynq: Added USB host support for zynq boards
ARM: zynq: Enable the FAT write capability
ARM: zynq: Move USB/SD/MMC common FAT configs
ARM: zynq: Enable EXT4 configs

 arch/arm/cpu/armv7/zynq/cpu.c              |  13 ++++
 arch/arm/cpu/armv7/zynq/ddrc.c             |   5 +-
 arch/arm/cpu/armv7/zynq/slcr.c             |  87 ++++++++++++++++++++++--
 arch/arm/cpu/armv7/zynq/spl.c              |   7 ++
 arch/arm/include/asm/arch-zynq/hardware.h  |  13 +++-
 arch/arm/include/asm/arch-zynq/sys_proto.h |   2 +
 board/xilinx/zynq/board.c                  |  25 ++++---
 drivers/usb/host/Makefile                  |   1 +
 drivers/usb/host/ehci-zynq.c               | 104 +++++++++++++++++++++++++++++
 include/configs/zynq-common.h              |  32 +++++++--
 include/configs/zynq_zc70x.h               |   1 +
 include/configs/zynq_zed.h                 |   1 +
 12 files changed, 268 insertions(+), 23 deletions(-)
 create mode 100644 drivers/usb/host/ehci-zynq.c

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/e8101c5e/attachment.pgp>

#1 lore raw

PATCH 1/18 ARM: zynq: Fix sparse warnings in slcr.c

Warnings:
arch/arm/cpu/armv7/zynq/slcr.c:21:6: warning: symbol 'zynq_slcr_lock' was not declared. Should it be static? arch/arm/cpu/armv7/zynq/slcr.c:27:6: warning: symbol 'zynq_slcr_unlock' was not declared. Should it be static? arch/arm/cpu/armv7/zynq/slcr.c:34:6: warning: symbol 'zynq_slcr_cpu_reset' was not declared. Should it be static? arch/arm/cpu/armv7/zynq/slcr.c:54:6: warning: symbol 'zynq_slcr_gem_clk_setup' was not declared. Should it be static? arch/arm/cpu/armv7/zynq/slcr.c:81:6: warning: symbol 'zynq_slcr_devcfg_disable' was not declared. Should it be static? arch/arm/cpu/armv7/zynq/slcr.c:94:6: warning: symbol 'zynq_slcr_devcfg_enable' was not declared. Should it be static? arch/arm/cpu/armv7/zynq/slcr.c:107:5: warning: symbol 'zynq_slcr_get_boot_mode' was not declared. Should it be static? arch/arm/cpu/armv7/zynq/slcr.c:113:5: warning: symbol 'zynq_slcr_get_idcode' was not declared. Should it be static?

---

 arch/arm/cpu/armv7/zynq/slcr.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/cpu/armv7/zynq/slcr.c +1 -0
index d7c1882..c326a4c 100644
@@ -8,6 +8,7 @@
 #include <asm/io.h>
 #include <malloc.h>
 #include <asm/arch/hardware.h>
+#include <asm/arch/sys_proto.h>
 #include <asm/arch/clk.h>
 
 #define SLCR_LOCK_MAGIC		0x767B

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/4671f852/attachment.pgp>

#2 lore raw

PATCH 2/18 ARM: zynq: Fix sparse warning in ddrc.c

In reply to Michal Simek

Warning:
arch/arm/cpu/armv7/zynq/ddrc.c:43:24: warning: Using plain integer as NULL pointer

---

 arch/arm/cpu/armv7/zynq/ddrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv7/zynq/ddrc.c +1 -1
index ba6a6ae..302654d 100644
@@ -40,7 +40,7 @@ void zynq_ddrc_init(void)
 		 * first stage bootloader. To get ECC to work all memory has
 		 * been initialized by writing any value.
 		 */
-		memset(0, 0, 1 * 1024 * 1024);
+		memset((void *)0, 0, 1 * 1024 * 1024);
 	} else {
 		puts("Memory: ECC disabled\n");
 	}

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/c2c29a1d/attachment.pgp>

#3 lore raw

PATCH 3/18 ARM: zynq: Remove sparse warnings

In reply to Michal Simek

Warnings:
board/xilinx/zynq/board.c:17:13: warning: symbol 'fpga' was not declared. Should it be static? board/xilinx/zynq/board.c:20:13: warning: symbol 'fpga010' was not declared. Should it be static? board/xilinx/zynq/board.c:21:13: warning: symbol 'fpga015' was not declared. Should it be static? board/xilinx/zynq/board.c:22:13: warning: symbol 'fpga020' was not declared. Should it be static? board/xilinx/zynq/board.c:23:13: warning: symbol 'fpga030' was not declared. Should it be static? board/xilinx/zynq/board.c:24:13: warning: symbol 'fpga045' was not declared. Should it be static? board/xilinx/zynq/board.c:25:13: warning: symbol 'fpga100' was not declared. Should it be static? board/xilinx/zynq/board.c:120:5: warning: symbol 'board_mmc_init' was not declared. Should it be static?

---

 board/xilinx/zynq/board.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
board/xilinx/zynq/board.c +9 -7
index c8cc2bc..5190938 100644
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <fpga.h>
+#include <mmc.h>
 #include <netdev.h>
 #include <zynqpl.h>
 #include <asm/arch/hardware.h>
@@ -14,15 +16,15 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_FPGA
-xilinx_desc fpga;
+static xilinx_desc fpga;
 
 /* It can be done differently */
-xilinx_desc fpga010 = XILINX_XC7Z010_DESC(0x10);
-xilinx_desc fpga015 = XILINX_XC7Z015_DESC(0x15);
-xilinx_desc fpga020 = XILINX_XC7Z020_DESC(0x20);
-xilinx_desc fpga030 = XILINX_XC7Z030_DESC(0x30);
-xilinx_desc fpga045 = XILINX_XC7Z045_DESC(0x45);
-xilinx_desc fpga100 = XILINX_XC7Z100_DESC(0x100);
+static xilinx_desc fpga010 = XILINX_XC7Z010_DESC(0x10);
+static xilinx_desc fpga015 = XILINX_XC7Z015_DESC(0x15);
+static xilinx_desc fpga020 = XILINX_XC7Z020_DESC(0x20);
+static xilinx_desc fpga030 = XILINX_XC7Z030_DESC(0x30);
+static xilinx_desc fpga045 = XILINX_XC7Z045_DESC(0x45);
+static xilinx_desc fpga100 = XILINX_XC7Z100_DESC(0x100);
 #endif
 
 int board_init(void)

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/65c8243b/attachment.pgp>

#4 lore raw

PATCH 4/18 ARM: zynq: Added efuse status register base address

In reply to Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

Added efuse status register base address. This register is used for determining whether efuse was blown or not. Also, added the zynq_get_silicon_version() to get the silicon version of the zynq board.

---

 arch/arm/cpu/armv7/zynq/cpu.c              | 13 +++++++++++++
 arch/arm/include/asm/arch-zynq/hardware.h  |  9 +++++++++
 arch/arm/include/asm/arch-zynq/sys_proto.h |  1 +
 3 files changed, 23 insertions(+)
arch/arm/cpu/armv7/zynq/cpu.c +13 -0
index 7626b5c..816d0c5 100644
@@ -14,6 +14,9 @@ void lowlevel_init(void)
 {
 }
 
+#define ZYNQ_SILICON_VER_MASK	0xF0000000
+#define ZYNQ_SILICON_VER_SHIFT	28
+
 int arch_cpu_init(void)
 {
 	zynq_slcr_unlock();
@@ -42,6 +45,16 @@ int arch_cpu_init(void)
 	return 0;
 }
 
+unsigned int zynq_get_silicon_version(void)
+{
+	unsigned int ver;
+
+	ver = (readl(&devcfg_base->mctrl) &
+	       ZYNQ_SILICON_VER_MASK) >> ZYNQ_SILICON_VER_SHIFT;
+
+	return ver;
+}
+
 void reset_cpu(ulong addr)
 {
 	zynq_slcr_cpu_reset();
arch/arm/include/asm/arch-zynq/hardware.h +9 -0
index 39184da..20f62bf 100644
@@ -22,6 +22,7 @@
 #define ZYNQ_SPI_BASEADDR0		0xE0006000
 #define ZYNQ_SPI_BASEADDR1		0xE0007000
 #define ZYNQ_DDRC_BASEADDR		0xF8006000
+#define ZYNQ_EFUSE_BASEADDR		0xF800D000
 
 /* Bootmode setting values */
 #define ZYNQ_BM_MASK		0xF
@@ -130,4 +131,12 @@ struct ddrc_regs {
 };
 #define ddrc_base ((struct ddrc_regs *)ZYNQ_DDRC_BASEADDR)
 
+struct efuse_reg {
+	u32 reserved1[4];
+	u32 status;
+	u32 reserved2[3];
+};
+
+#define efuse_base ((struct efuse_reg *)ZYNQ_EFUSE_BASEADDR)
+
 #endif /* _ASM_ARCH_HARDWARE_H */
arch/arm/include/asm/arch-zynq/sys_proto.h +1 -0
index a68e1b3..2445a04 100644
@@ -16,6 +16,7 @@ extern void zynq_slcr_devcfg_enable(void);
 extern u32 zynq_slcr_get_boot_mode(void);
 extern u32 zynq_slcr_get_idcode(void);
 extern void zynq_ddrc_init(void);
+extern unsigned int zynq_get_silicon_version(void);
 
 /* Driver extern functions */
 extern int zynq_sdhci_init(u32 regbase);

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/3d203cfb/attachment.pgp>

#5 lore raw

PATCH 5/18 ARM: zynq: Do not use half memory size for ECC case

In reply to Michal Simek

Memory size should be specified without ECC place. If you need to have half memory size, please change u-boot configuration.

---

 arch/arm/cpu/armv7/zynq/ddrc.c | 3 ---
 1 file changed, 3 deletions(-)
arch/arm/cpu/armv7/zynq/ddrc.c +0 -3
index 302654d..e0ed3bf 100644
@@ -44,7 +44,4 @@ void zynq_ddrc_init(void)
 	} else {
 		puts("Memory: ECC disabled\n");
 	}
-
-	if (width == ZYNQ_DDRC_CTRLREG_BUSWIDTH_16BIT)
-		gd->ram_size /= 2;
 }

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/0b4d7def/attachment.pgp>

#6 lore raw

PATCH 6/18 ARM: zynq: Call zynq board_init() in SPL

In reply to Michal Simek

From: Michal Simek <[email protected]>

Call board_init() if SPL is configured with CONFIG_SPL_BOARD_INIT.

---

 arch/arm/cpu/armv7/zynq/spl.c | 7 +++++++
 include/configs/zynq-common.h | 1 +
 2 files changed, 8 insertions(+)
arch/arm/cpu/armv7/zynq/spl.c +7 -0
index fcad762..c3ea221 100644
@@ -28,6 +28,13 @@ void board_init_f(ulong dummy)
 	board_init_r(NULL, 0);
 }
 
+#ifdef CONFIG_SPL_BOARD_INIT
+void spl_board_init(void)
+{
+	board_init();
+}
+#endif
+
 u32 spl_boot_device(void)
 {
 	u32 mode;
include/configs/zynq-common.h +1 -0
index 731e69b..2080a61 100644
@@ -235,6 +235,7 @@
 #define CONFIG_SPL_LIBCOMMON_SUPPORT
 #define CONFIG_SPL_LIBGENERIC_SUPPORT
 #define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_BOARD_INIT
 
 #define CONFIG_SPL_LDSCRIPT	"arch/arm/cpu/armv7/zynq/u-boot-spl.lds"
 

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/9eb50c8b/attachment.pgp>

#7 lore raw

PATCH 7/18 ARM: zynq: slcr: Fix incorrect commentary

In reply to Michal Simek

Fix c&p error in zynq_slcr_devcfg_enable() commentary and extending it with description according to Zynq TRM also in zynq_slcr_devcfg_disable().

---

 arch/arm/cpu/armv7/zynq/slcr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/zynq/slcr.c +2 -2
index c326a4c..1ff1eac 100644
@@ -83,7 +83,7 @@ void zynq_slcr_devcfg_disable(void)
 {
 	zynq_slcr_unlock();
 
-	/* Disable AXI interface */
+	/* Disable AXI interface by asserting FPGA resets */
 	writel(0xFFFFFFFF, &slcr_base->fpga_rst_ctrl);
 
 	/* Set Level Shifters DT618760 */
@@ -99,7 +99,7 @@ void zynq_slcr_devcfg_enable(void)
 	/* Set Level Shifters DT618760 */
 	writel(0xF, &slcr_base->lvl_shftr_en);
 
-	/* Disable AXI interface */
+	/* Enable AXI interface by de-asserting FPGA resets */
 	writel(0x0, &slcr_base->fpga_rst_ctrl);
 
 	zynq_slcr_lock();

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/5f81e901/attachment.pgp>

#8 lore raw

PATCH 8/18 ARM: zynq: Setup correct slcr_lock value

In reply to Michal Simek

The driver should setup slcr state according
to slcr operations.

---

 arch/arm/cpu/armv7/zynq/slcr.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/zynq/slcr.c +6 -2
index 1ff1eac..5ba58fa 100644
@@ -21,14 +21,18 @@ static int slcr_lock = 1; /* 1 means locked, 0 means unlocked */
 
 void zynq_slcr_lock(void)
 {
-	if (!slcr_lock)
+	if (!slcr_lock) {
 		writel(SLCR_LOCK_MAGIC, &slcr_base->slcr_lock);
+		slcr_lock = 1;
+	}
 }
 
 void zynq_slcr_unlock(void)
 {
-	if (slcr_lock)
+	if (slcr_lock) {
 		writel(SLCR_UNLOCK_MAGIC, &slcr_base->slcr_unlock);
+		slcr_lock = 0;
+	}
 }
 
 /* Reset the entire system */

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/fe9313e0/attachment.pgp>

#9 lore raw

PATCH 9/18 ARM: zynq: Fix bootmode mask

In reply to Michal Simek

From: Mike Looijmans <[email protected]>

Bootmode mask was defined as 0x0F, but documentation mentions 0x07. Experiments show that bit "3" is the JTAG chain configuration. Change the mask to "7" to allow systems with a different chain configuration to boot correctly.

---

 arch/arm/include/asm/arch-zynq/hardware.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/arch-zynq/hardware.h +1 -1
index 20f62bf..a9d091f 100644
@@ -25,7 +25,7 @@
 #define ZYNQ_EFUSE_BASEADDR		0xF800D000
 
 /* Bootmode setting values */
-#define ZYNQ_BM_MASK		0xF
+#define ZYNQ_BM_MASK		0x7
 #define ZYNQ_BM_NOR		0x2
 #define ZYNQ_BM_SD		0x5
 #define ZYNQ_BM_JTAG		0x0

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/e076a056/attachment.pgp>

#10 lore raw

PATCH 10/18 ARM: zynq: Fix building SPL without FPGA support

In reply to Michal Simek

When CONFIG_FPGA is defined but CONFIG_SPL_FPGA is not, the build fails:
board.c: In function 'board_init':
board.c:41:3: error: 'fpga' undeclared (first use in this function)
fpga = fpga010;

Fix this by expanding the "#if.." around this block to match the other FPGA checks and don't compile this block when buildign for SPL without FPGA support.

Tested a bootloader that had CONFIG_FPGA defined without CONFIG_SPL_FPGA, this now compiles without errors and loading FPGA from u-boot works.

---

 board/xilinx/zynq/board.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
board/xilinx/zynq/board.c +6 -3
index 5190938..258632e 100644
@@ -15,7 +15,8 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_FPGA
+#if (defined(CONFIG_FPGA) && !defined(CONFIG_SPL_BUILD)) || \
+    (defined(CONFIG_SPL_FPGA_SUPPORT) && defined(CONFIG_SPL_BUILD))
 static xilinx_desc fpga;
 
 /* It can be done differently */
@@ -29,7 +30,8 @@ static xilinx_desc fpga100 = XILINX_XC7Z100_DESC(0x100);
 
 int board_init(void)
 {
-#ifdef CONFIG_FPGA
+#if (defined(CONFIG_FPGA) && !defined(CONFIG_SPL_BUILD)) || \
+    (defined(CONFIG_SPL_FPGA_SUPPORT) && defined(CONFIG_SPL_BUILD))
 	u32 idcode;
 
 	idcode = zynq_slcr_get_idcode();
@@ -56,7 +58,8 @@ int board_init(void)
 	}
 #endif
 
-#ifdef CONFIG_FPGA
+#if (defined(CONFIG_FPGA) && !defined(CONFIG_SPL_BUILD)) || \
+    (defined(CONFIG_SPL_FPGA_SUPPORT) && defined(CONFIG_SPL_BUILD))
 	fpga_init();
 	fpga_add(fpga_xilinx, &fpga);
 #endif

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/f51fee04/attachment.pgp>

#11 lore raw

PATCH 11/18 ARM: zynq: Extend kernel image size to 60MB

In reply to Michal Simek

Extend max kernel image size. Gunzip is checking this value. If kernel is larger, message below is shown.

Uncompressing Kernel Image ... Error: inflate() returned -5
GUNZIP: uncompress, out-of-mem or overwrite error - must RESET board to recover

---

 include/configs/zynq-common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/zynq-common.h +1 -1
index 2080a61..8ee78e4 100644
@@ -209,7 +209,7 @@
 #define CONFIG_RSA
 
 /* Extend size of kernel image for uncompression */
-#define CONFIG_SYS_BOOTM_LEN	(20 * 1024 * 1024)
+#define CONFIG_SYS_BOOTM_LEN	(60 * 1024 * 1024)
 
 /* Boot FreeBSD/vxWorks from an ELF image */
 #if defined(CONFIG_ZYNQ_BOOT_FREEBSD)

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/d5c92bce/attachment.pgp>

#12 lore raw

PATCH 12/18 ARM: zynq: Add MIO detection code

In reply to Michal Simek

From: Michal Simek <[email protected]>

Add run-time MIO pin detection to get actual
pin configuration for specific periphery.

---

 arch/arm/cpu/armv7/zynq/slcr.c             | 50 ++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-zynq/sys_proto.h |  1 +
 2 files changed, 51 insertions(+)
arch/arm/cpu/armv7/zynq/slcr.c +50 -0
index 5ba58fa..51894f9 100644
@@ -17,6 +17,26 @@
 #define SLCR_IDCODE_MASK	0x1F000
 #define SLCR_IDCODE_SHIFT	12
 
+/*
+ * zynq_slcr_mio_get_status - Get the status of MIO peripheral.
+ *
+ * @peri_name: Name of the peripheral for checking MIO status
+ * @get_pins: Pointer to array of get pin for this peripheral
+ * @num_pins: Number of pins for this peripheral
+ * @mask: Mask value
+ * @check_val: Required check value to get the status of  periph
+ */
+struct zynq_slcr_mio_get_status {
+	const char *peri_name;
+	const int *get_pins;
+	int num_pins;
+	u32 mask;
+	u32 check_val;
+};
+
+static const struct zynq_slcr_mio_get_status mio_periphs[] = {
+};
+
 static int slcr_lock = 1; /* 1 means locked, 0 means unlocked */
 
 void zynq_slcr_lock(void)
@@ -120,3 +140,33 @@ u32 zynq_slcr_get_idcode(void)
 	return (readl(&slcr_base->pss_idcode) & SLCR_IDCODE_MASK) >>
 							SLCR_IDCODE_SHIFT;
 }
+
+/*
+ * zynq_slcr_get_mio_pin_status - Get the MIO pin status of peripheral.
+ *
+ * @periph: Name of the peripheral
+ *
+ * Returns count to indicate the number of pins configured for the
+ * given @periph.
+ */
+int zynq_slcr_get_mio_pin_status(const char *periph)
+{
+	const struct zynq_slcr_mio_get_status *mio_ptr;
+	int val, i, j;
+	int mio = 0;
+
+	for (i = 0; i < ARRAY_SIZE(mio_periphs); i++) {
+		if (strcmp(periph, mio_periphs[i].peri_name) == 0) {
+			mio_ptr = &mio_periphs[i];
+			for (j = 0; j < mio_ptr->num_pins; j++) {
+				val = readl(&slcr_base->mio_pin
+						[mio_ptr->get_pins[j]]);
+				if ((val & mio_ptr->mask) == mio_ptr->check_val)
+					mio++;
+			}
+			break;
+		}
+	}
+
+	return mio;
+}
arch/arm/include/asm/arch-zynq/sys_proto.h +1 -0
index 2445a04..53c30ec 100644
@@ -15,6 +15,7 @@ extern void zynq_slcr_devcfg_disable(void);
 extern void zynq_slcr_devcfg_enable(void);
 extern u32 zynq_slcr_get_boot_mode(void);
 extern u32 zynq_slcr_get_idcode(void);
+extern int zynq_slcr_get_mio_pin_status(const char *periph);
 extern void zynq_ddrc_init(void);
 extern unsigned int zynq_get_silicon_version(void);
 

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/8f57f5bf/attachment.pgp>

#13 lore raw

PATCH 13/18 ARM: zynq: ehci: Added USB host driver support

In reply to Michal Simek

From: Michal Simek <[email protected]>

Added USB host driver for zynq.

---

 arch/arm/cpu/armv7/zynq/slcr.c            |  24 +++++++
 arch/arm/include/asm/arch-zynq/hardware.h |   2 +
 drivers/usb/host/Makefile                 |   1 +
 drivers/usb/host/ehci-zynq.c              | 104 ++++++++++++++++++++++++++++++
 4 files changed, 131 insertions(+)
 create mode 100644 drivers/usb/host/ehci-zynq.c
arch/arm/cpu/armv7/zynq/slcr.c +24 -0
index 51894f9..934ccc3 100644
@@ -14,6 +14,8 @@
 #define SLCR_LOCK_MAGIC		0x767B
 #define SLCR_UNLOCK_MAGIC	0xDF0D
 
+#define SLCR_USB_L1_SEL			0x04
+
 #define SLCR_IDCODE_MASK	0x1F000
 #define SLCR_IDCODE_SHIFT	12
 
@@ -34,7 +36,29 @@ struct zynq_slcr_mio_get_status {
 	u32 check_val;
 };
 
+static const int usb0_pins[] = {
+	28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39
+};
+
+static const int usb1_pins[] = {
+	40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51
+};
+
 static const struct zynq_slcr_mio_get_status mio_periphs[] = {
+	{
+		"usb0",
+		usb0_pins,
+		ARRAY_SIZE(usb0_pins),
+		SLCR_USB_L1_SEL,
+		SLCR_USB_L1_SEL,
+	},
+	{
+		"usb1",
+		usb1_pins,
+		ARRAY_SIZE(usb1_pins),
+		SLCR_USB_L1_SEL,
+		SLCR_USB_L1_SEL,
+	},
 };
 
 static int slcr_lock = 1; /* 1 means locked, 0 means unlocked */
arch/arm/include/asm/arch-zynq/hardware.h +2 -0
index a9d091f..2aede0c 100644
@@ -23,6 +23,8 @@
 #define ZYNQ_SPI_BASEADDR1		0xE0007000
 #define ZYNQ_DDRC_BASEADDR		0xF8006000
 #define ZYNQ_EFUSE_BASEADDR		0xF800D000
+#define ZYNQ_USB_BASEADDR0		0xE0002000
+#define ZYNQ_USB_BASEADDR1		0xE0003000
 
 /* Bootmode setting values */
 #define ZYNQ_BM_MASK		0x7
drivers/usb/host/Makefile +1 -0
index 578b097..bf87204 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
 obj-$(CONFIG_USB_EHCI_SPEAR) += ehci-spear.o
 obj-$(CONFIG_USB_EHCI_TEGRA) += ehci-tegra.o
 obj-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o
+obj-$(CONFIG_USB_EHCI_ZYNQ) += ehci-zynq.o
 
 # xhci
 obj-$(CONFIG_USB_XHCI) += xhci.o xhci-mem.o xhci-ring.o
drivers/usb/host/ehci-zynq.c new file +104 -0

104 lines not on this page · raw message

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/907bd595/attachment.pgp>

#14 lore raw

PATCH 14/18 ARM: zynq: Added USB host support for zynq boards

In reply to Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

Added configs to support USB host for zynq boards. Also added a command usbboot to boot from usb.

---

 include/configs/zynq-common.h | 20 +++++++++++++++++++-
 include/configs/zynq_zc70x.h  |  1 +
 include/configs/zynq_zed.h    |  1 +
 3 files changed, 21 insertions(+), 1 deletion(-)
include/configs/zynq-common.h +19 -1
index 8ee78e4..bcc476e 100644
@@ -89,6 +89,18 @@
 # define CONFIG_DOS_PARTITION
 #endif
 
+#ifdef CONFIG_ZYNQ_USB
+# define CONFIG_USB_EHCI
+# define CONFIG_CMD_USB
+# define CONFIG_USB_STORAGE
+# define CONFIG_SUPPORT_VFAT
+# define CONFIG_USB_EHCI_ZYNQ
+# define CONFIG_USB_ULPI_VIEWPORT
+# define CONFIG_USB_ULPI
+# define CONFIG_EHCI_IS_TDI
+# define CONFIG_USB_MAX_CONTROLLER_COUNT	2
+#endif
+
 #define CONFIG_SYS_I2C_ZYNQ
 /* I2C */
 #if defined(CONFIG_SYS_I2C_ZYNQ)
@@ -150,7 +162,13 @@
 		"bootm ${load_addr}\0" \
 	"jtagboot=echo TFTPing FIT to RAM... && " \
 		"tftpboot ${load_addr} ${fit_image} && " \
-		"bootm ${load_addr}\0"
+		"bootm ${load_addr}\0" \
+	"usbboot=if usb start; then " \
+			"echo Copying FIT from USB to RAM... && " \
+			"fatload usb 0 ${load_addr} ${fit_image} && " \
+			"bootm ${load_addr}\0" \
+		"fi\0"
+
 #define CONFIG_BOOTCOMMAND		"run $modeboot"
 #define CONFIG_BOOTDELAY		3 /* -1 to Disable autoboot */
 #define CONFIG_SYS_LOAD_ADDR		0 /* default? */
include/configs/zynq_zc70x.h +1 -0
index de0e241..291a5fe 100644
@@ -19,6 +19,7 @@
 #define CONFIG_SYS_NO_FLASH
 
 #define CONFIG_ZYNQ_SDHCI0
+#define CONFIG_ZYNQ_USB
 #define CONFIG_ZYNQ_I2C0
 #define CONFIG_ZYNQ_EEPROM
 #define CONFIG_ZYNQ_BOOT_FREEBSD
include/configs/zynq_zed.h +1 -0
index 274140c..ce17d40 100644
@@ -18,6 +18,7 @@
 
 #define CONFIG_SYS_NO_FLASH
 
+#define CONFIG_ZYNQ_USB
 #define CONFIG_ZYNQ_SDHCI0
 #define CONFIG_ZYNQ_BOOT_FREEBSD
 #define CONFIG_DEFAULT_DEVICE_TREE	zynq-zed

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/84871b06/attachment.pgp>

#15 lore raw

PATCH 15/18 ARM: zynq: Enable the FAT write capability

In reply to Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

Enable the FAT write capability for SD/MMC write
functionality.

---

 include/configs/zynq-common.h | 1 +
 1 file changed, 1 insertion(+)
include/configs/zynq-common.h +1 -0
index bcc476e..1cfc963 100644
@@ -86,6 +86,7 @@
 # define CONFIG_CMD_FAT
 # define CONFIG_SUPPORT_VFAT
 # define CONFIG_CMD_EXT2
+# define CONFIG_FAT_WRITE
 # define CONFIG_DOS_PARTITION
 #endif
 

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/448cad41/attachment.pgp>

#16 lore raw

PATCH 16/18 ARM: zynq: Move USB/SD/MMC common FAT configs

In reply to Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

Moved the USB/SD/MMC common FAT configs separately to avoid redefinition warnings.

---

 include/configs/zynq-common.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
include/configs/zynq-common.h +8 -6
index 1cfc963..0a7d104 100644
@@ -83,18 +83,12 @@
 # define CONFIG_SDHCI
 # define CONFIG_ZYNQ_SDHCI
 # define CONFIG_CMD_MMC
-# define CONFIG_CMD_FAT
-# define CONFIG_SUPPORT_VFAT
-# define CONFIG_CMD_EXT2
-# define CONFIG_FAT_WRITE
-# define CONFIG_DOS_PARTITION
 #endif
 
 #ifdef CONFIG_ZYNQ_USB
 # define CONFIG_USB_EHCI
 # define CONFIG_CMD_USB
 # define CONFIG_USB_STORAGE
-# define CONFIG_SUPPORT_VFAT
 # define CONFIG_USB_EHCI_ZYNQ
 # define CONFIG_USB_ULPI_VIEWPORT
 # define CONFIG_USB_ULPI
@@ -102,6 +96,14 @@
 # define CONFIG_USB_MAX_CONTROLLER_COUNT	2
 #endif
 
+#if defined(CONFIG_ZYNQ_SDHCI) || defined(CONFIG_ZYNQ_USB)
+# define CONFIG_SUPPORT_VFAT
+# define CONFIG_CMD_FAT
+# define CONFIG_CMD_EXT2
+# define CONFIG_FAT_WRITE
+# define CONFIG_DOS_PARTITION
+#endif
+
 #define CONFIG_SYS_I2C_ZYNQ
 /* I2C */
 #if defined(CONFIG_SYS_I2C_ZYNQ)

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/36deb61b/attachment.pgp>

#17 lore raw

PATCH 17/18 ARM: zynq: Enable EXT4 configs

In reply to Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

Enabled the EXT4 configs.

---

 include/configs/zynq-common.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/zynq-common.h +2 -0
index 0a7d104..09d6c55 100644
@@ -102,6 +102,8 @@
 # define CONFIG_CMD_EXT2
 # define CONFIG_FAT_WRITE
 # define CONFIG_DOS_PARTITION
+# define CONFIG_CMD_EXT4
+# define CONFIG_CMD_EXT4_WRITE
 #endif
 
 #define CONFIG_SYS_I2C_ZYNQ

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/0b3b8011/attachment.pgp>

#18 lore raw

PATCH 18/18 ARM: zynq: Extend maximum number of command arguments

In reply to Michal Simek

15 was too small for variables stored in file on MMC.

---

 include/configs/zynq-common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/zynq-common.h +1 -1
index 09d6c55..d2149b3 100644
@@ -188,7 +188,7 @@
 #define CONFIG_SYS_LONGHELP
 #define CONFIG_CLOCKS
 #define CONFIG_CMD_CLK
-#define CONFIG_SYS_MAXARGS		15 /* max number of command args */
+#define CONFIG_SYS_MAXARGS		32 /* max number of command args */
 #define CONFIG_SYS_CBSIZE		256 /* Console I/O Buffer Size */
 #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + \
 					sizeof(CONFIG_SYS_PROMPT) + 16)

--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140425/4fd2569f/attachment.pgp>