[U-Boot] [PATCH v7] socfpga: Adding Scan Manager driver

Chin Liang See clsee at altera.com
Mon Mar 24 16:25:03 CET 2014


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 <clsee at altera.com>
> > Cc: Dinh Nguyen <dinguyen at altera.com>
> > Cc: Wolfgang Denk <wd at denx.de>
> > CC: Pavel Machek <pavel at denx.de>
> > Cc: Tom Rini <trini at ti.com>
> > Cc: Albert Aribaud <albert.u.boot at aribaud.net>
> > ---
> > 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*/
> 
> <space>*/ here.

same as above.

Thanks
Chin Liang

> 
> Thanks,
> Michal
> 




More information about the U-Boot mailing list