socfpga: Adding Scan Manager driver
PATCH v6 1/1 socfpga: Adding Scan Manager driver
Scan Manager driver will be called to configure the IOCSR scan chain. This configuration will setup the IO buffer settings
---
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 | 211 +++++++ arch/arm/cpu/armv7/socfpga/spl.c | 4 + arch/arm/include/asm/arch-socfpga/scan_manager.h | 96 +++ .../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, 988 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
arch/arm/cpu/armv7/socfpga/Makefile +1 -1
@@ -9,4 +9,4 @@ obj-y := lowlevel_init.o obj-y += misc.o timer.o reset_manager.o system_manager.o -obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o +obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o scan_manager.o
arch/arm/cpu/armv7/socfpga/scan_manager.c new file +211 -0
211 lines not on this page · raw message
arch/arm/cpu/armv7/socfpga/spl.c +4 -0
@@ -32,6 +32,10 @@ void spl_board_init(void)/* freeze all IO banks */ sys_mgr_frzctrl_freeze_req (); +/* configure the IOCSR / IO buffer settings */ +if (scan_mgr_configure_iocsr ()) +hang (); +/* configure the pin muxing through system manager */ sysmgr_pinmux_init ();#endif /* CONFIG_SOCFPGA_VIRTUAL_TARGET */
arch/arm/include/asm/arch-socfpga/scan_manager.h new file +96 -0
96 lines not on this page · raw message
arch/arm/include/asm/arch-socfpga/socfpga_base_addrs.h +1 -0
@@ -13,5 +13,6 @@#define SOCFPGA_OSC1TIMER0_ADDRESS 0xffd00000#define SOCFPGA_RSTMGR_ADDRESS 0xffd05000#define SOCFPGA_SYSMGR_ADDRESS 0xffd08000 +#define SOCFPGA_SCANMGR_ADDRESS 0xfff02000#endif /* _SOCFPGA_BASE_ADDRS_H_ */
board/altera/socfpga/iocsr_config.c new file +657 -0
657 lines not on this page · raw message
board/altera/socfpga/iocsr_config.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* Copyright Altera Corporation (C) 2012-2014. All rights reserved +* +* SPDX-License-Identifier: BSD-3-Clause +*/ + +/* This file is generated by Preloader Generator */ + +#ifndef _PRELOADER_IOCSR_CONFIG_H_ +#define _PRELOADER_IOCSR_CONFIG_H_ + +#define CONFIG_HPS_IOCSR_SCANCHAIN0_LENGTH (764) +#define CONFIG_HPS_IOCSR_SCANCHAIN1_LENGTH (1719) +#define CONFIG_HPS_IOCSR_SCANCHAIN2_LENGTH (955) +#define CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH (16766) + +#endif /*_PRELOADER_IOCSR_CONFIG_H_*/
include/configs/socfpga_cyclone5.h +1 -0
@@ -8,6 +8,7 @@#include <asm/arch/socfpga_base_addrs.h> #include "../../board/altera/socfpga/pinmux_config.h" +#include "../../board/altera/socfpga/iocsr_config.h" /* * High level configuration
Signature · 1 line
1.7.9.5
PATCH v6 1/1 socfpga: Adding Scan Manager driver
Quoted 22 lines · Chin Liang See
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 <[email protected]>Cc Dinh Nguyen <[email protected]>Cc Wolfgang Denk <[email protected]>CC Pavel Machek <[email protected]>Cc Tom Rini <[email protected]>Cc Albert Aribaud <[email protected]>---
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
Quoted 8 lines
--- arch/arm/cpu/armv7/socfpga/Makefile | 2 +- arch/arm/cpu/armv7/socfpga/scan_manager.c | 211 +++++++ arch/arm/cpu/armv7/socfpga/spl.c | 4 + arch/arm/include/asm/arch-socfpga/scan_manager.h | 96 +++ .../include/asm/arch-socfpga/socfpga_base_addrs.h | 1 + board/altera/socfpga/iocsr_config.c | 657 ++++++++++++++++++++ board/altera/socfpga/iocsr_config.h | 17 +
I still have problem with content of these two files.
In iocsr_config.c is ~600 lines which targets just one specific hardware design configuration. I can't see any reason why this should go to mainline and stay there. Because it brings no value.
I would recommend you just to define that arrays like this
const unsigned long iocsr_scan_chain0_table[];
const unsigned long iocsr_scan_chain0_table[];
...
+ in header
#define CONFIG_HPS_IOCSR_SCANCHAIN0_LENGTH 0 #define CONFIG_HPS_IOCSR_SCANCHAIN1_LENGTH 0 #define CONFIG_HPS_IOCSR_SCANCHAIN2_LENGTH 0 #define CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH 0
and write these 2 files by hand. Then your users will just replace them by hand for specific board/design.
Thanks,
Michal
Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140228/7e3e10f2/attachment.pgp>
PATCH v6 1/1 socfpga: Adding Scan Manager driver
Hi Michal,
Quoted 44 lines · Michal Simek
Quoted 22 lines · Chin Liang See
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 <[email protected]>Cc Dinh Nguyen <[email protected]>Cc Wolfgang Denk <[email protected]>CC Pavel Machek <[email protected]>Cc Tom Rini <[email protected]>Cc Albert Aribaud <[email protected]>---
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-rc1Quoted 8 lines
--- arch/arm/cpu/armv7/socfpga/Makefile | 2 +- arch/arm/cpu/armv7/socfpga/scan_manager.c | 211 +++++++ arch/arm/cpu/armv7/socfpga/spl.c | 4 + arch/arm/include/asm/arch-socfpga/scan_manager.h | 96 +++ .../include/asm/arch-socfpga/socfpga_base_addrs.h | 1 + board/altera/socfpga/iocsr_config.c | 657 ++++++++++++++++++++ board/altera/socfpga/iocsr_config.h | 17 +I still have problem with content of these two files.
Iniocsr_config.cis ~600 lines which targets just one specific hardware design configuration. I can't see any reason why this should go to mainline and stay there. Because it brings no value.I would recommend you just to define that arrays like this
const unsigned long iocsr_scan_chain0_table[];
const unsigned long iocsr_scan_chain0_table[];
...
Quoted 8 lines
+ in header
#define CONFIG_HPS_IOCSR_SCANCHAIN0_LENGTH 0 #define CONFIG_HPS_IOCSR_SCANCHAIN1_LENGTH 0 #define CONFIG_HPS_IOCSR_SCANCHAIN2_LENGTH 0 #define CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH 0and write these 2 files by hand. Then your users will just replace them by hand for specific board/design.
Actually the intention is that user can pull the code from git and build it. We want to avoid any tools dependency here.
At same time, these files are located inside board folders. If user have different boards, they will have new set of folders here their own handoff files. From there, there won't the need to regenerate everytime.
Thanks
Chin Liang
Quoted 4 lines
Thanks,
Michal
PATCH v6 1/1 socfpga: Adding Scan Manager driver
Quoted 53 lines · Chin Liang See
Hi Michal,
Quoted 50 lines · Michal Simek
Quoted 22 lines · Chin Liang See
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 <[email protected]>Cc Dinh Nguyen <[email protected]>Cc Wolfgang Denk <[email protected]>CC Pavel Machek <[email protected]>Cc Tom Rini <[email protected]>Cc Albert Aribaud <[email protected]>---
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-rc1Quoted 8 lines
--- arch/arm/cpu/armv7/socfpga/Makefile | 2 +- arch/arm/cpu/armv7/socfpga/scan_manager.c | 211 +++++++ arch/arm/cpu/armv7/socfpga/spl.c | 4 + arch/arm/include/asm/arch-socfpga/scan_manager.h | 96 +++ .../include/asm/arch-socfpga/socfpga_base_addrs.h | 1 + board/altera/socfpga/iocsr_config.c | 657 ++++++++++++++++++++ board/altera/socfpga/iocsr_config.h | 17 +I still have problem with content of these two files.
Iniocsr_config.cis ~600 lines which targets just one specific hardware design configuration. I can't see any reason why this should go to mainline and stay there. Because it brings no value.I would recommend you just to define that arrays like this
const unsigned long iocsr_scan_chain0_table[];
const unsigned long iocsr_scan_chain0_table[];
...+ in header
#define CONFIG_HPS_IOCSR_SCANCHAIN0_LENGTH 0 #define CONFIG_HPS_IOCSR_SCANCHAIN1_LENGTH 0 #define CONFIG_HPS_IOCSR_SCANCHAIN2_LENGTH 0 #define CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH 0
Quoted 5 lines
Quoted 2 lines
and write these 2 files by hand. Then your users will just replace them by hand for specific board/design.
Actually the intention is that user can pull the code from git and build it. We want to avoid any tools dependency here.
There is tool dependency even you don't want to have it. These files are autogenerated by tools it means you already have dependency.
Also I expect that you can change all pins for uarts/ethernets/spi/i2c/etc that's why there is no golden configuration for socfpga that's why it is better to keep it empty just to compile it.
Quoted 3 lines
At same time, these files are located inside board folders. If user have different boards, they will have new set of folders here their own handoff files. From there, there won't the need to regenerate everytime.
Please explain me one thing how many users will use this configuration? Especially these ~600 lines?
I also expect that you can generate unlimited number of configuration for the same board. It means this is just one configuration for one board which you will use till the time when you find out a bug in your tools and you will regenerate this.
Also I expect that socfpga_cyclone is family that's why you are also missing connection to the real board that's why every socfpga user will have to open tool and generate this configuration for the board (Or can download it from web or get with the board).
It is the same situation which we have with zynq that's why I didn't add our ps7_init file because it is just useless for others.
Thanks,
Michal
Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140304/a54e5eb5/attachment.pgp>
PATCH v6 1/1 socfpga: Adding Scan Manager driver
Hi!
Quoted 3 lines
Also I expect that you can change all pins for uarts/ethernets/spi/i2c/etc that's why there is no golden configuration for socfpga that's why it is better to keep it empty just to compile it.
Well, there are some development boards around... and having u-boot able to boot on the devel board by default would be very very useful.
Quoted 6 lines
Quoted 3 lines
At same time, these files are located inside board folders. If user have different boards, they will have new set of folders here their own handoff files. From there, there won't the need to regenerate everytime.
Please explain me one thing how many users will use this configuration? Especially these ~600 lines?
Pretty much everyone when they test-boot their system...?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH v6 1/1 socfpga: Adding Scan Manager driver
Hi Pavel,
2014-03-05 17:13 GMT+01:00 Pavel Machek <[email protected]>:
Quoted 10 lines
Hi!
Quoted 1 line
Also I expect that you can change all pins for
uarts/ethernets/spi/i2c/etc
Quoted 2 lines
that's why there is no golden configuration for socfpga that's why it is better to keep it empty just to compile it.
Well, there are some development boards around... and having u-boot able to boot on the devel board by default would be very very useful.
I believe you but the point is somewhere else if you can reach it by universal
target.
Quoted 12 lines
Quoted 2 lines
Quoted 2 lines
At same time, these files are located inside board folders. If user
have
Quoted 2 lines
Quoted 2 lines
different boards, they will have new set of folders here their own handoff files. From there, there won't the need to regenerate
everytime.
Quoted 3 lines
Please explain me one thing how many users will use this configuration? Especially these ~600 lines?
Pretty much everyone when they test-boot their system...?
Really? It means that all development boards/custom boards with socfpga use the same configuration which seems to me weird.
If yes, then why these files are autogenerated if the same config can be use for
all boards?
Thanks,
Michal
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
PATCH v6 1/1 socfpga: Adding Scan Manager driver
Quoted 38 lines · Michal Simek
Hi Pavel,
2014-03-05 17:13 GMT+01:00 Pavel Machek <[email protected]>:
Hi!> Also I expect that you can change all pins for uarts/ethernets/spi/i2c/etc
> that's why there is no golden configuration for socfpga that's why
> it is better to keep it empty just to compile it.Well, there are some development boards around... and having u-boot
able to boot on the devel board by default would be very very useful.I believe you but the point is somewhere else if you can reach it by universal
target.
> > At same time, these files are located inside board folders. If user have
> > different boards, they will have new set of folders here their own
> > handoff files. From there, there won't the need to regenerate everytime.
>
> Please explain me one thing how many users will use this configuration?
> Especially these ~600 lines?
Quoted 6 lines
Pretty much everyone when they test-boot their system...?
Really? It means that all development boards/custom boards with socfpga
I believe you confuse with arch and board. These files are located inside board. For board/altera/socfpga, its referring to Altera dev kit. When another vendor, example like Xilinx, fabricated a board with SOCFPGA chip, then it will have another folder called board/xilinx/socfpga.
Quoted 6 lines
use the same configuration which seems to me weird.
If yes, then why these files are autogenerated if the same config can be use for
all boards?
Probably an example will clear your doubt. When the board is fabricated, the pin mux used will be fixed. You won't need to change it until you fabricated a new board.
Hope this info helps.
Thanks
Chin Liang
Quoted 6 lines
Thanks,
Michal
PATCH v6 1/1 socfpga: Adding Scan Manager driver
Quoted 46 lines · Chin Liang See
Quoted 38 lines · Michal Simek
Hi Pavel,
2014-03-05 17:13 GMT+01:00 Pavel Machek <[email protected]>:
Hi!> Also I expect that you can change all pins for uarts/ethernets/spi/i2c/etc
> that's why there is no golden configuration for socfpga that's why
> it is better to keep it empty just to compile it.Well, there are some development boards around... and having u-boot
able to boot on the devel board by default would be very very useful.I believe you but the point is somewhere else if you can reach it by universal
target.
> > At same time, these files are located inside board folders. If user have
> > different boards, they will have new set of folders here their own
> > handoff files. From there, there won't the need to regenerate everytime.
>
> Please explain me one thing how many users will use this configuration?
> Especially these ~600 lines?Quoted 6 lines
Pretty much everyone when they test-boot their system...?
Really? It means that all development boards/custom boards with socfpga
Quoted 5 lines
I believe you confuse with arch and board. These files are located inside board. For board/altera/socfpga, its referring to Altera dev kit. When another vendor, example like Xilinx, fabricated a board with SOCFPGA chip, then it will have another folder called board/xilinx/socfpga.
That explains a lot. Why isn't call devkit then?
Quoted 9 lines
Quoted 6 lines
use the same configuration which seems to me weird.
If yes, then why these files are autogenerated if the same config can be use for
all boards?Probably an example will clear your doubt. When the board is fabricated, the pin mux used will be fixed. You won't need to change it until you fabricated a new board.
I understand that you want to have something which you can just compile and boot. But only pins are fixed not internal connection inside chip. Also I expect you have connectors on the board which you can use for add-on cards.
My doubts are just based on my experience with zynq that not everything what it is generated by tools is really needed to get board boot. Also boards have just fixed pins but not internal connections to these pins. I believe that this is just the same for your dev kit.
Also I hardly believe that you need all 600lines just to have something to boot.
Thanks,
Michal
Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140307/96305201/attachment.pgp>
PATCH v6 1/1 socfpga: Adding Scan Manager driver
Hi Michal,
Quoted 47 lines · Michal Simek
Quoted 46 lines · Chin Liang See
Quoted 44 lines · Michal Simek
Hi Pavel,
2014-03-05 17:13 GMT+01:00 Pavel Machek <[email protected]>:
Hi!> Also I expect that you can change all pins for uarts/ethernets/spi/i2c/etc
> that's why there is no golden configuration for socfpga that's why
> it is better to keep it empty just to compile it.Well, there are some development boards around... and having u-boot
able to boot on the devel board by default would be very very useful.I believe you but the point is somewhere else if you can reach it by universal
target.
> > At same time, these files are located inside board folders. If user have
> > different boards, they will have new set of folders here their own
> > handoff files. From there, there won't the need to regenerate everytime.
>
> Please explain me one thing how many users will use this configuration?
> Especially these ~600 lines?Pretty much everyone when they test-boot their system...?
Really? It means that all development boards/custom boards with socfpga
Quoted 8 lines
Quoted 5 lines
I believe you confuse with arch and board. These files are located inside board. For board/altera/socfpga, its referring to Altera dev kit. When another vendor, example like Xilinx, fabricated a board with SOCFPGA chip, then it will have another folder called board/xilinx/socfpga.
That explains a lot. Why isn't call devkit then?
Examples always nice when I explaining and I love examples. While the naming, it would be interesting topic which same as giving baby's name.
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
use the same configuration which seems to me weird.
If yes, then why these files are autogenerated if the same config can be use for
all boards?Probably an example will clear your doubt. When the board is fabricated, the pin mux used will be fixed. You won't need to change it until you fabricated a new board.
Quoted 11 lines
I understand that you want to have something which you can just compile and boot. But only pins are fixed not internal connection inside chip. Also I expect you have connectors on the board which you can use for add-on cards.
My doubts are just based on my experience with zynq that not everything what it is generated by tools is really needed to get board boot. Also boards have just fixed pins but not internal connections to these pins. I believe that this is just the same for your dev kit.
Also I hardly believe that you need all 600lines just to have something to boot.
Both SOCFPGA and Zynq are unique due to its programmability. But in this case, all our configurations here would only support golden system reference design on Altera dev kit. This would make our lives much easier.
Thanks
Chin Liang
Quoted 3 lines
Thanks,
Michal
PATCH v6 1/1 socfpga: Adding Scan Manager driver
In reply to Chin Liang SeeHi!
Quoted 17 lines
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 <[email protected]>Cc Dinh Nguyen <[email protected]>Cc Wolfgang Denk <[email protected]>CC Pavel Machek <[email protected]>Cc Tom Rini <[email protected]>Cc Albert Aribaud <[email protected]>arch/arm/cpu/armv7/socfpga/scan_manager.c new file +7
-0+static inline uint32_t scan_chain_engine_is_idle (uint32_t max_iter) +{ +uint32_t scanmgr_status; + + scanmgr_status =readl (&scan_manager_base->stat); + +/* Poll the engine until the scan engine is inactive */
arch/arm/cpu/armv7/socfpga/scan_manager.c line 39
Quoted 10 lines
arch/arm/cpu/armv7/socfpga/scan_manager.c new file +10
-0+while (SCANMGR_STAT_ACTIVE_GET (scanmgr_status) || + (SCANMGR_STAT_WFIFOCNT_GET (scanmgr_status) >0 )) { + max_iter--; +if (max_iter >0 ) + scanmgr_status =readl (&scan_manager_base->stat); +else +return SCAN_MGR_STATUS_ACTIVE ; + } +return SCAN_MGR_STATUS_IDLE ; +}
The function is named _is_idle, but returns 1 if it is _active_. I'd get rid of SCAN_MGR_STATUS_* defines (they make it harder to read) and reverse the logic...
Quoted 6 lines
arch/arm/cpu/armv7/socfpga/scan_manager.c new file +6
-0+/* Program HPS IO Scan Chain */ +uint32_t scan_mgr_io_scan_chain_prg ( +uint32_t io_scan_chain_id, +uint32_t io_scan_chain_len_in_bits, +const uint32_t *iocsr_scan_chain) +{
...
arch/arm/cpu/armv7/socfpga/scan_manager.c line 67
Quoted 6 lines
arch/arm/cpu/armv7/socfpga/scan_manager.c new file +6
-0+/* +* Check if the scan chain engine is inactive and the +* WFIFO is empty before enabling the IO scan chain +*/ +if (scan_chain_engine_is_idle (SCAN_MAX_DELAY ) !=SCAN_MGR_STATUS_IDLE ) +return 1 ;
Maybe it would be better to return <0 numbers on error?
Should the function be static? Then it could have shorter name...
arch/arm/cpu/armv7/socfpga/scan_manager.c line 187
Quoted 1 line
arch/arm/cpu/armv7/socfpga/scan_manager.c new file +1
-0+/* Disable IO Scan chain when configuration done*/
I'd put space before end of comment.
arch/arm/include/asm/arch-socfpga/scan_manager.h line 85
Quoted 10 lines
arch/arm/include/asm/arch-socfpga/scan_manager.h new file +10
-0+/* +* Program HPS IO Scan Chain +* io_scan_chain_id - IO scan chain ID +* io_scan_chain_len_in_bits - IO scan chain length in bits +* iocsr_scan_chain - IO scan chain table +*/ +uint32_t scan_mgr_io_scan_chain_prg ( +uint32_t io_scan_chain_id, +uint32_t io_scan_chain_len_in_bits, +const uint32_t *iocsr_scan_chain);
...and you can probably drop the prototype...
Thanks,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH v6 1/1 socfpga: Adding Scan Manager driver
Hi Pavel,
Quoted 25 lines · ZY - pavel
Hi!
Quoted 23 lines
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 <[email protected]>Cc Dinh Nguyen <[email protected]>Cc Wolfgang Denk <[email protected]>CC Pavel Machek <[email protected]>Cc Tom Rini <[email protected]>Cc Albert Aribaud <[email protected]>arch/arm/cpu/armv7/socfpga/scan_manager.c new file +13
-0+static inline uint32_t scan_chain_engine_is_idle (uint32_t max_iter) +{ +uint32_t scanmgr_status; + + scanmgr_status =readl (&scan_manager_base->stat); + +/* Poll the engine until the scan engine is inactive */ +while (SCANMGR_STAT_ACTIVE_GET (scanmgr_status) || + (SCANMGR_STAT_WFIFOCNT_GET (scanmgr_status) >0 )) { + max_iter--; +if (max_iter >0 ) + scanmgr_status =readl (&scan_manager_base->stat); +else
Quoted 8 lines
arch/arm/cpu/armv7/socfpga/scan_manager.c line 39
Quoted 4 lines
arch/arm/cpu/armv7/socfpga/scan_manager.c new file +4
-0+return SCAN_MGR_STATUS_ACTIVE ; + } +return SCAN_MGR_STATUS_IDLE ; +}The function is named
_is_idle, but returns 1 if it is _active_. I'd get rid of SCAN_MGR_STATUS_* defines (they make it harder to read) and reverse the logic...
This seems is controversial function :)
Yup, I already fixed that by removed the status variable.
Quoted 8 lines
Quoted 7 lines
arch/arm/cpu/armv7/socfpga/scan_manager.c new file +6
-0+/* Program HPS IO Scan Chain */ +uint32_t scan_mgr_io_scan_chain_prg ( +uint32_t io_scan_chain_id, +uint32_t io_scan_chain_len_in_bits, +const uint32_t *iocsr_scan_chain) +{...
Quoted 9 lines
arch/arm/cpu/armv7/socfpga/scan_manager.c line 67
Quoted 6 lines
arch/arm/cpu/armv7/socfpga/scan_manager.c new file +6
-0+/* +* Check if the scan chain engine is inactive and the +* WFIFO is empty before enabling the IO scan chain +*/ +if (scan_chain_engine_is_idle (SCAN_MAX_DELAY ) !=SCAN_MGR_STATUS_IDLE ) +return 1 ;Maybe it would be better to return <0 numbers on error?
I changed that to if (!scan_chain_engine_is_idle(SCAN_MAX_DELAY)) It should much better now
Quoted 2 lines
Should the function be static? Then it could have shorter name...
Its already static and fit into single line now.
Quoted 4 lines
arch/arm/cpu/armv7/socfpga/scan_manager.c line 187
Quoted 1 line
arch/arm/cpu/armv7/socfpga/scan_manager.c new file +1
-0+/* Disable IO Scan chain when configuration done*/ I'd put space before end of comment.
Quoted 12 lines
arch/arm/include/asm/arch-socfpga/scan_manager.h line 85
Quoted 10 lines
arch/arm/include/asm/arch-socfpga/scan_manager.h new file +10
-0+/* +* Program HPS IO Scan Chain +* io_scan_chain_id - IO scan chain ID +* io_scan_chain_len_in_bits - IO scan chain length in bits +* iocsr_scan_chain - IO scan chain table +*/ +uint32_t scan_mgr_io_scan_chain_prg ( +uint32_t io_scan_chain_id, +uint32_t io_scan_chain_len_in_bits, +const uint32_t *iocsr_scan_chain);...and you can probably drop the prototype...
Removed. Thanks
Chin Liang
Quoted 3 lines
Thanks,
Pavel
PATCH v6 1/1 socfpga: Adding Scan Manager driver
Hi!
Quoted 2 lines
I changed that to if (!scan_chain_engine_is_idle(SCAN_MAX_DELAY)) It should much better now
Yes, thanks.
Quoted 1 line
Removed. Thanks
Thanks for all the changes, it looks better now, so you have my Acked-by in another thread.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH v6 1/1 socfpga: Adding Scan Manager driver
Quoted 6 lines · ZY - pavel
Hi!
Quoted 2 lines
I changed that to if (!scan_chain_engine_is_idle(SCAN_MAX_DELAY)) It should much better now
Quoted 6 lines
Yes, thanks.
Quoted 1 line
Removed. Thanks
Thanks for all the changes, it looks better now, so you have my Acked-by in another thread.
Thanks for reviewing too!
Chin Liang
Quoted 1 line
Pavel