From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chin Liang See Date: Mon, 24 Mar 2014 10:25:03 -0500 Subject: [U-Boot] [PATCH v7] socfpga: Adding Scan Manager driver In-Reply-To: <532075C8.70205@monstr.eu> References: <1394035559-3378-1-git-send-email-clsee@altera.com> <532075C8.70205@monstr.eu> Message-ID: <1395674703.2268.10.camel@clsee-VirtualBox.altera.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Michal, On Wed, 2014-03-12 at 15:57 +0100, Michal Simek wrote: > On 03/05/2014 05:05 PM, Chin Liang See wrote: > > Scan Manager driver will be called to configure the IOCSR > > scan chain. This configuration will setup the IO buffer settings > > > > Signed-off-by: Chin Liang See > > Cc: Dinh Nguyen > > Cc: Wolfgang Denk > > CC: Pavel Machek > > Cc: Tom Rini > > Cc: Albert Aribaud > > --- > > Changes for v7 > > - Enhance the function scan_chain_engine_is_idle > > Changes for v6 > > - Fixed various coding style issue > > Changes for v5 > > - Removal of additional blank line > > - Added comment for magic number > > Changes for v4 > > - avoid code duplication by add goto error > > - include underscore to variables name > > Changes for v3 > > - merge the handoff file and driver into single patch > > Changes for v2 > > - rebase with latest v2014.01-rc1 > > --- > > arch/arm/cpu/armv7/socfpga/Makefile | 2 +- > > arch/arm/cpu/armv7/socfpga/scan_manager.c | 209 +++++++ > > arch/arm/cpu/armv7/socfpga/spl.c | 4 + > > arch/arm/include/asm/arch-socfpga/scan_manager.h | 90 +++ > > .../include/asm/arch-socfpga/socfpga_base_addrs.h | 1 + > > board/altera/socfpga/iocsr_config.c | 657 ++++++++++++++++++++ > > board/altera/socfpga/iocsr_config.h | 17 + > > include/configs/socfpga_cyclone5.h | 1 + > > 8 files changed, 980 insertions(+), 1 deletion(-) > > create mode 100644 arch/arm/cpu/armv7/socfpga/scan_manager.c > > create mode 100644 arch/arm/include/asm/arch-socfpga/scan_manager.h > > create mode 100644 board/altera/socfpga/iocsr_config.c > > create mode 100644 board/altera/socfpga/iocsr_config.h > > > > + /* > > + * Program the last part of IO scan chain write TDI_TDO packet > > + * header (2 bytes) to scan manager > > + */ > > + writel(tdi_tdo_header, &scan_manager_base->fifo_double_byte); > > + > > + for (i = 0; i < io_program_iter; i++) { > > + /* > > + * write remaining scan chain data into scan > > + * manager WFIFO with 4 bytes write > > + */ > > Wrong indentation here. Just a small cosmetic error. I would just leave it as of now. > > > > + writel(iocsr_scan_chain[index + i], > > + &scan_manager_base->fifo_quad_byte); > > + } > > + > > + index += io_program_iter; > > + residual = io_scan_chain_data_residual & > > + IO_SCAN_CHAIN_32BIT_MASK; > > + > > + if (IO_SCAN_CHAIN_PAYLOAD_24BIT < residual) { > > + /* > > + * write the last 4B scan chain data > > + * into scan manager WFIFO > > + */ > > + writel(iocsr_scan_chain[index], > > + &scan_manager_base->fifo_quad_byte); > > + } else { > > + /* > > + * write the remaining 1 - 3 bytes scan chain > > + * data into scan manager WFIFO byte by byte > > + * to prevent JTAG engine shifting unused data > > + * from the FIFO and mistaken the data as a > > + * valid command (even though unused bits are > > + * set to 0, but just to prevent hardware > > + * glitch) > > + */ > > + for (i = 0; i < residual; i += 8) { > > + writel(((iocsr_scan_chain[index] >> i) > > + & IO_SCAN_CHAIN_BYTE_MASK), > > + &scan_manager_base->fifo_single_byte); > > + } > > + } > > + > > + /* > > + * Check if the scan chain engine has completed the > > + * IO scan chain data shifting > > + */ > > + if (!scan_chain_engine_is_idle(SCAN_MAX_DELAY)) > > + goto error; > > + } > > + > > + /* Disable IO Scan chain when configuration done*/ > > */ here. same as above. Thanks Chin Liang > > Thanks, > Michal >