[U-Boot] [PATCH v2 2/2] imx: Add support for the SabreSD shipped with i.MX6DL
The SabreSD platform is available with i.MX6Q or i.MX6DL. This patch adds the support of the i.MX6DL. The config file and the board directory are renamed to remove the reference to the MX6Q. Signed-off-by: Pierre Aubert p.aub...@staubli.com CC: Stefano Babic sba...@denx.de --- Changes in v2: - update MAINTAINERS - code cleanup - remove the Soc type from the board name MAINTAINERS|2 +- .../freescale/{mx6qsabresd = mx6sabresd}/Makefile |2 +- .../mx6qsabresd.c = mx6sabresd/mx6sabresd.c} |7 ++- boards.cfg |5 +++-- include/configs/mx6qsabreauto.h|2 +- .../{mx6qsabre_common.h = mx6sabre_common.h} |1 - include/configs/{mx6qsabresd.h = mx6sabresd.h}|2 +- 7 files changed, 9 insertions(+), 12 deletions(-) rename board/freescale/{mx6qsabresd = mx6sabresd}/Makefile (98%) rename board/freescale/{mx6qsabresd/mx6qsabresd.c = mx6sabresd/mx6sabresd.c} (98%) rename include/configs/{mx6qsabre_common.h = mx6sabre_common.h} (99%) rename include/configs/{mx6qsabresd.h = mx6sabresd.h} (97%) diff --git a/MAINTAINERS b/MAINTAINERS index 643a5ac..50ca73c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -661,7 +661,7 @@ Fabio Estevam fabio.este...@freescale.com mx31pdk i.MX31 mx53ard i.MX53 mx53smd i.MX53 - mx6qsabresd i.MX6Q + mx6sabresd i.MX6Q/DL mx6qsabreauto i.MX6Q wandboard i.MX6DL/S diff --git a/board/freescale/mx6qsabresd/Makefile b/board/freescale/mx6sabresd/Makefile similarity index 98% rename from board/freescale/mx6qsabresd/Makefile rename to board/freescale/mx6sabresd/Makefile index 5693772..ff3c94b 100644 --- a/board/freescale/mx6qsabresd/Makefile +++ b/board/freescale/mx6sabresd/Makefile @@ -23,7 +23,7 @@ include $(TOPDIR)/config.mk LIB= $(obj)lib$(BOARD).o -COBJS := mx6qsabresd.o +COBJS := mx6sabresd.o SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/board/freescale/mx6qsabresd/mx6qsabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c similarity index 98% rename from board/freescale/mx6qsabresd/mx6qsabresd.c rename to board/freescale/mx6sabresd/mx6sabresd.c index 0d7cb9e..1b6805b 100644 --- a/board/freescale/mx6qsabresd/mx6qsabresd.c +++ b/board/freescale/mx6sabresd/mx6sabresd.c @@ -17,12 +17,10 @@ * GNU General Public License for more details. */ -#include common.h -#include asm/io.h #include asm/arch/clock.h #include asm/arch/imx-regs.h #include asm/arch/iomux.h -#include asm/arch/mx6q_pins.h +#include asm/arch/mx6-pins.h #include asm/errno.h #include asm/gpio.h #include asm/imx-common/iomux-v3.h @@ -291,7 +289,6 @@ int board_late_init(void) int checkboard(void) { - puts(Board: MX6Q-SabreSD\n); - + puts(Board: MX6-SabreSD\n); return 0; } diff --git a/boards.cfg b/boards.cfg index 31483d6..427cb11 100644 --- a/boards.cfg +++ b/boards.cfg @@ -256,9 +256,10 @@ mx53smd arm armv7 mx53smd freesca ima3-mx53arm armv7 ima3-mx53 esg mx5ima3-mx53:IMX_CONFIG=board/esg/ima3-mx53/imximage.cfg vision2 arm armv7 vision2 ttcontrol mx5 vision2:IMX_CONFIG=board/ttcontrol/vision2/imximage_hynix.cfg mx6qarm2 arm armv7 mx6qarm2 freescale mx6 mx6qarm2:IMX_CONFIG=board/freescale/mx6qarm2/imximage.cfg -mx6qsabreautoarm armv7 mx6qsabreauto freescale mx6 mx6qsabreauto:IMX_CONFIG=board/freescale/mx6qsabreauto/imximage.cfg +mx6qsabreautoarm armv7 mx6qsabreauto freescale mx6 mx6qsabreauto:IMX_CONFIG=board/freescale/mx6qsabreauto/imximage.cfg,MX6Q mx6qsabrelitearm armv7 mx6qsabrelite freescale mx6 mx6qsabrelite:IMX_CONFIG=board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg -mx6qsabresd arm armv7 mx6qsabresd freescale mx6 mx6qsabresd:IMX_CONFIG=board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg +mx6qsabresd arm armv7 mx6sabresd freescale mx6 mx6sabresd:IMX_CONFIG=board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg,MX6Q +mx6dlsabresd arm armv7 mx6sabresd freescale mx6 mx6sabresd:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6dl.cfg,MX6DL eco5pk arm armv7 eco5pk 8dtech omap3 nitrogen6dl arm armv7 nitrogen6x boundary mx6 nitrogen6x:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6dl.cfg,MX6DL,DDR_MB=1024 nitrogen6dl2g
Re: [U-Boot] [U-Boot, v3, 6/8] USB: SS: Add support for Super Speed USB interface
Hi Julius, On Fri, Apr 19, 2013 at 11:52 PM, Julius Werner jwer...@chromium.org wrote: Migrating my comments here for public discussion. Thanks for your valuable comments here. This adds usb framework support for super-speed usb, which will further facilitate to add stack support for xHCI. Signed-off-by: Vikas C Sajjan vikas.saj...@samsung.com Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- Changes from v2: - Replacing if-else with switch-case in portspeed() in cmd_usb.c common/cmd_usb.c | 24 ++-- common/usb.c |5 + common/usb_hub.c |8 ++-- include/usb.h |6 ++ include/usb_defs.h | 24 +++- 5 files changed, 58 insertions(+), 9 deletions(-) diff --git a/common/cmd_usb.c b/common/cmd_usb.c index dacdc2d..594385a 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -271,12 +271,24 @@ static void usb_display_config(struct usb_device *dev) static inline char *portspeed(int speed) { - if (speed == USB_SPEED_HIGH) - return 480 Mb/s; - else if (speed == USB_SPEED_LOW) - return 1.5 Mb/s; - else - return 12 Mb/s; + char *speed_str; + + switch (speed) { + case USB_SPEED_SUPER: + speed_str = 5 Gb/s; + break; + case USB_SPEED_HIGH: + speed_str = 480 Mb/s; + break; + case USB_SPEED_LOW: + speed_str = 1.5 Mb/s; + break; + default: + speed_str = 12 Mb/s; + break; + } + + return speed_str; } /* shows the device tree recursively */ diff --git a/common/usb.c b/common/usb.c index 3a96a34..55fff5b 100644 --- a/common/usb.c +++ b/common/usb.c @@ -409,6 +409,11 @@ static int usb_parse_config(struct usb_device *dev, wMaxPacketSize); debug(if %d, ep %d\n, ifno, epno); break; + case USB_DT_SS_ENDPOINT_COMP: + if_desc = dev-config.if_desc[ifno]; + memcpy(if_desc-ss_ep_comp_desc[epno], + buffer[index], buffer[index]); + break; default: if (head-bLength == 0) return 1; diff --git a/common/usb_hub.c b/common/usb_hub.c index ab41943..1e225e6 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -165,7 +165,9 @@ static struct usb_hub_device *usb_hub_allocate(void) static inline char *portspeed(int portstatus) { - if (portstatus (1 USB_PORT_FEAT_HIGHSPEED)) + if (portstatus (1 USB_PORT_FEAT_SUPERSPEED)) It doesn't make sense to use the USB_PORT_FEAT_ constants to read a port status here. These should be USB_PORT_STAT_ instead (you could use a switch statement if you mask and shift them correctly). True, we should be 'ANDing' here with respectve PORT_STAT_ constants, will modify this as required. + return 5 Gb/s; + else if (portstatus (1 USB_PORT_FEAT_HIGHSPEED)) return 480 Mb/s; else if (portstatus (1 USB_PORT_FEAT_LOWSPEED)) return 1.5 Mb/s; @@ -268,7 +270,9 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port) /* Allocate a new device struct for it */ usb = usb_alloc_new_device(dev-controller); - if (portstatus USB_PORT_STAT_HIGH_SPEED) + if (portstatus USB_PORT_STAT_SUPER_SPEED) + usb-speed = USB_SPEED_SUPER; + else if (portstatus USB_PORT_STAT_HIGH_SPEED) usb-speed = USB_SPEED_HIGH; else if (portstatus USB_PORT_STAT_LOW_SPEED) usb-speed = USB_SPEED_LOW; Should change to switch statement after implementing my suggestion to usb_defs.h Sure, diff --git a/include/usb.h b/include/usb.h index d79c865..d7b082d 100644 --- a/include/usb.h +++ b/include/usb.h @@ -76,6 +76,12 @@ struct usb_interface { unsigned char act_altsetting; struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS]; + /* + * Super Speed Device will have Super Speed Endpoint + * Companion Descriptor (section 9.6.7 of usb 3.0 spec) + * Revision 1.0 June 6th 2011 + */ + struct usb_ss_ep_comp_descriptor ss_ep_comp_desc[USB_MAXENDPOINTS]; } __attribute__ ((packed)); /* Configuration information.. */ diff --git a/include/usb_defs.h b/include/usb_defs.h index 0c78d9d..e2aaef3 100644 --- a/include/usb_defs.h +++ b/include/usb_defs.h @@ -203,6 +203,8 @@ #define USB_PORT_FEAT_POWER 8 #define USB_PORT_FEAT_LOWSPEED 9 #define USB_PORT_FEAT_HIGHSPEED 10 +#define USB_PORT_FEAT_FULLSPEED 11 +#define USB_PORT_FEAT_SUPERSPEED 12 Speed is never set as a feature anyway. We should just get rid of all of these and always use USB_PORT_STAT_ for them. These are simply 'Hub class feature numbers' given
Re: [U-Boot] [U-Boot, v3, 6/8] USB: SS: Add support for Super Speed USB interface
Hi Marek, On Sat, Apr 20, 2013 at 5:27 PM, Marek Vasut ma...@denx.de wrote: Dear Julius Werner, These patches haven't gone in yet, right? I think Vivek wants to discuss/update them himself, he just asked me to move my reviews to this thread. They're not in, but they're already pushed in my tree. It'd be also easier to review diff instead of full patches again. I shall send a diff patchset for these changes, but do we have a possibility of squashing the changes to earler commits at some point of time later, so that clean changes get to u-boot ? Or we shall go as you suggest. -- Best Regards Vivek ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] USB detection in u-boot oin our custom board
Sir, We are having our own custom board based on the FDI design,on which we are not able to mount USB. In the eaboard configuration files support for usb in the u-boot is there and we have commands to check the usb inserted. But this was not the case with FDI board,there were no commands for usb in uboot. So we inserted the files from the eaboard to our code and we were able to check USB command in u-boot. my query are Do fdi board support USB? When i am executing the below command following errors are coming: [code] uboot usb reset [code] [Quote] (Re)start USB... USB: ISP1301 Vendor ID : 0x04cc ISP1301 Product ID : 0x1301 ISP1301 Version ID : 0x0210 scanning bus for devices... 2 USB Device(s) found scanning bus for storage devices... ERROR: USB-error: DEVICENOTRESPONDId not provide a handshake (OUT) (5) ERROR: USB-error: DEVICENOTRESPONDING: Device did not respond to token (IN) or d not provide a handshake (OUT) (5) ERROR: USB-error: DATAOVERRUN: The amount of data returned by the endpoint excd either the size of the maximum data packet allowed from the endpoint (found in MaximumPacketSize field of ED) or the remaining buffer size. (8) ERROR: USB-error: DATAOVERRUN: The amount of data returned by the endpoint exced either the size of the maximum data packet allowed from the endpoint (found in MaximumPacketSize field of ED) or the remaining buffer size. (8) ERROR: USB-error: DATAOVERRUN: The amount of data returned by the endpoint excd either the size of the maximum data packet allowed from the endpoint (found in MaximumPacketSize field of ED) or the remaining buffer size. (8) ERROR: USB-error: DATAOVERRUN: The amount of data returned by the endpoint exced either the size of the maximum data packet allowed from the endpoint (found in MaximumPacketSize field of ED) or the remaining buffer size. (8) ERROR: USB-error: DATAOVERRUN: The amount of data returned by the endpoint excd either the size of the maximum data packet allowed from the endpoint (found in MaximumPacketSize field of ED) or the remaining buffer size. (8) ERROR: USB-error: DATAOVERRUN: The amount of data returned by the endpoint exced either the size of the maximum data packet allowed from the endpoint (found in MaximumPacketSize field of ED) or the remaining buffer size. (8) ERROR: USB-error: DATAOVERRUN: The amount of data returned by the endpoint excd either the size of the maximum data packet allowed from the endpoint (found in MaximumPacketSize field of ED) or the remaining buffer size. (8) ERROR: USB-error: DATAOVERRUN: The amount of data returned by the endpoint exced either the size of the maximum data packet allowed from the endpoint (found in MaximumPacketSize field of ED) or the remaining buffer size. (8) ERROR: USB-error: DATAOVERRUN: The amount of data returned by the endpoint excd either the size of the maximum data packet allowed from the endpoint (found in MaximumPacketSize field of ED) or the remaining buffer size. (8) ERROR: USB-error: DATAOVERRUN: The amount of data returned by the endpoint exced either the size of the maximum data packet allowed from the endpoint (found in MaximumPacketSize field of ED) or the remaining buffer size. (8) ** Can't read Driver Desriptor Block ** ERROR: USB-error: DATAOVERRUN: The amount of data returned by the endpoint excd either the size of the maximum data packet allowed from the endpoint (found in MaximumPacketSize field
Re: [U-Boot] [PATCH 3/3] mx6sl: Add initial support for mx6slevk board
On 21/04/2013 19:00, Fabio Estevam wrote: Hi Stefano, On Wed, Apr 17, 2013 at 5:48 AM, Stefano Babic sba...@denx.de wrote: Ok, let's do in this way - I agree that U-boot should only turn on the clocks that it requires and do not touch the rest. But let's start pushing this into u-boot-imx and then we can trim this setup. Please let me know when this series reach u-boot-imx, so that I can work on disabling the unneeded clocks. They are ready to be merged - I will put it into u-boot-imx. Regards, Stefano -- = DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de = ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] imx: Add titanium board support (i.MX6 based)
On 10/04/2013 09:17, Stefan Roese wrote: Titanium is a i.MX6 based board from ProjectionDesign / Barco. This patch adds support for this board with the newly introduced NAND support for i.MX6. Signed-off-by: Stefan Roese s...@denx.de --- Applied to u-boot-imx, thanks. Best regards, Stefano Babic -- = DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de = ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] imx: Add titanium board support (i.MX6 based)
On 22.04.2013 10:07, Stefano Babic wrote: On 10/04/2013 09:17, Stefan Roese wrote: Titanium is a i.MX6 based board from ProjectionDesign / Barco. This patch adds support for this board with the newly introduced NAND support for i.MX6. Signed-off-by: Stefan Roese s...@denx.de --- Applied to u-boot-imx, thanks. Thanks Stefano! Just checking, did you add the imx6 NAND support patchset as well? I'm asking since the titanium patch depends on this. Thanks. Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3 v2] ppc4xx: Add SPL support
On 02.04.2013 10:37, Stefan Roese wrote: This patch adds SPL booting support (NOR flash) for the PPC4xx platforms. This SPL booting (Falcon mode) will be used by the upcoming lcd4_lwmon5 board port (lwmon5 variant). Signed-off-by: Stefan Roese s...@denx.de Applied to u-boot-ppc4xx/master. Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/3] Makefile: Add target for combined u-boot.img spl/u-boot.bin
On 22.02.2013 11:36, Stefan Roese wrote: This new make target u-boot-img-spl-at-end.bin consists of the the real, full-blown U-Boot image and the U-Boot SPL binary directly attached to it. The full-blown U-Boot image has the mkimage header included, with its load-address and entry-point. This will be used by the upcoming lwmon5 PPC440EPx derivate board port. Signed-off-by: Stefan Roese s...@denx.de Applied to u-boot-ppc4xx/master. Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/3 v3] ppc4xx: Add lcd4_lwmon5 support
On 08.03.2013 16:50, Stefan Roese wrote: This patch adds the fast booting LWMON5 derivat lcd4_lwmon5. Its a stripped down version of the full blown lwmon5 support, without ECC, USB, POST and some other stuff. It used the newly introduced SPL infrastrucure for SPL from NOR flash booting on the PPC4xx. By setting the environment variable boot_os to yes, Linux will be started from the SPL version. If not, the normal U-Boot will be started. Signed-off-by: Stefan Roese s...@denx.de Applied to u-boot-ppc4xx/master. Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [U-Boot, v3, 3/8] usb: hub: Power-cycle on root-hub ports
HI Julius, On Sat, Apr 20, 2013 at 12:30 AM, Julius Werner jwer...@chromium.org wrote: XHCI ports are powered on after a H/W reset, however EHCI ports are not. So disabling and re-enabling power on all ports invariably. Signed-off-by: Amar amarendra...@samsung.com Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- Changes from v2: - Replaced USB_HUB_PRINTFs to debug() common/usb_hub.c | 34 ++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/common/usb_hub.c b/common/usb_hub.c index f2a0285..e4f4e3c 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -100,11 +100,45 @@ static void usb_hub_power_on(struct usb_hub_device *hub) int i; struct usb_device *dev; unsigned pgood_delay = hub-desc.bPwrOn2PwrGood * 2; + ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1); + unsigned short portstatus; + int ret; dev = hub-pusb_dev; /* Enable power to the ports */ debug(enabling power on all ports\n); for (i = 0; i dev-maxchild; i++) { + /* + * Power-cycle the ports here: aka, + * turning them off and turning on again. + */ + usb_clear_port_feature(dev, i + 1, USB_PORT_FEAT_POWER); + debug(port %d returns %lX\n, i + 1, dev-status); + + /* Wait at least 2*bPwrOn2PwrGood for PP to change */ + mdelay(pgood_delay); This adds 20ms per port to USB boot times... is it really necessary? Why do we need to powercycle XHCI ports? Couldn't we just check if the ports are powered and only power them on if they aren't? This 20ms delay is truely being taken to be on safer side (twice of Power-on-to-power-good), its not observational. In my earlier patch-series, we were doing the same way as you are suggesting here (power-on ports only if they aren't), however Marek suggested to power-cycle the ports. This would ensure that we don't have any spurious Port status (telling us that port is powered up). Actually i was seeing a strage behavior on USB 2.0 protocol ports available with XHCI. Since all ports with XHCI are powered-up after a Chip-reset, the instant we do a power-on on these ports (as with original code - simply setting the PORT_POWER feature), the Connect status change bit used to get cleared (however Current connect status bit was still set). So we arrived at solution that either we don't power-up XHCI ports or do a power-cycle on them. If you insist, please at least parallelize this. Disable power on all ports, wait, then check and reenable it. Hmm, so right now we are doing this for one port at a time. I am sure parallelising things as you suggested would be best to do here, but can you please explain, would handling one port at a time lead to unwanted behavior from Host's side somehow ? + + ret = usb_get_port_status(dev, i + 1, portsts); + if (ret 0) { + debug(port %d: get_port_status failed\n, i + 1); This is a severe error (because the ports won't come up again), so I think it should be a printf() instead of a debug(). Sure, will change this to pritnf() + return; + } + + /* + * Check to confirm the state of Port Power: + * xHCI says After modifying PP, s/w shall read + * PP and confirm that it has reached the desired state + * before modifying it again, undefined behavior may occur + * if this procedure is not followed. + * EHCI doesn't say anything like this, but no harm in keeping + * this. + */ + portstatus = le16_to_cpu(portsts-wPortStatus); + if (portstatus (USB_PORT_STAT_POWER 1)) { + debug(port %d: Port power change failed\n, i + 1); Same as above. Sure, will change this. + return; + } + usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER); debug(port %d returns %lX\n, i + 1, dev-status); } -- Best Regards Vivek ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Please pull u-boot-ppc4xx/master
Hi Tom! Please pull the following pending patches: The following changes since commit d10f68ae47b67acab8b110b5c605dde4197a1820: Prepare v2013.04 (2013-04-19 10:25:43 -0400) are available in the git repository at: git://www.denx.de/git/u-boot-ppc4xx.git master for you to fetch changes up to f47b048b3a283dca63cfdce46840dd477e591336: ppc4xx: Add lcd4_lwmon5 support (2013-04-22 09:53:53 +0200) Stefan Roese (3): ppc4xx: Add SPL support Makefile: Add target for combined u-boot.img spl/u-boot.bin ppc4xx: Add lcd4_lwmon5 support Makefile | 12 ++ arch/powerpc/cpu/ppc4xx/Makefile | 4 ++ arch/powerpc/cpu/ppc4xx/spl_boot.c | 72 arch/powerpc/cpu/ppc4xx/start.S| 37 +++-- arch/powerpc/cpu/ppc4xx/u-boot-spl.lds | 74 + arch/powerpc/cpu/ppc4xx/u-boot.lds | 2 + board/lwmon5/lwmon5.c | 75 +- board/lwmon5/sdram.c | 4 +- boards.cfg | 1 + config.mk | 4 ++ include/configs/lwmon5.h | 68 -- 11 files changed, 343 insertions(+), 10 deletions(-) create mode 100644 arch/powerpc/cpu/ppc4xx/spl_boot.c create mode 100644 arch/powerpc/cpu/ppc4xx/u-boot-spl.lds ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] imx: Add titanium board support (i.MX6 based)
On 22/04/2013 10:12, Stefan Roese wrote: On 22.04.2013 10:07, Stefano Babic wrote: On 10/04/2013 09:17, Stefan Roese wrote: Titanium is a i.MX6 based board from ProjectionDesign / Barco. This patch adds support for this board with the newly introduced NAND support for i.MX6. Signed-off-by: Stefan Roese s...@denx.de --- Applied to u-boot-imx, thanks. Thanks Stefano! Just checking, did you add the imx6 NAND support patchset as well? I'm asking since the titanium patch depends on this. Yes, it took only some time more because I had to merge them with other patches - consider this a confirm that imx6 NAND are applied ! Regards, Stefano -- = DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de = ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Driver Model Thoughts
Hi Simon, Hi Marek, Another U-Boot engineer and I are looking at running up driver model. Good, I'm now free of the shackles of the university project. Bring it on. It seems to work in sandbox quite nicely. I had half a mind to try to get some core patches together for this merge window, but have questions. For 'struct instance' it seems to be an attempt to keep the constant data separate from the dynamic data to reduce early RAM usage. But when I look at struct driver_instance, it seems to have a 'struct instance' within it (not a pointer). So doesn't this defeat that benefit? You presumably can't put struct driver_instance in read-only memory because you need it updates its flags. Honestly, I can't tell. I was never able to properly understand it from Pavel's explanation. I still have trouble keeping track of some of the naming - e.g. and instance feels to me like it should be called a device, and the naming of 'core' seems odd although I do understand the concept. Also bind/unbind seems like register/unregister to me - but maybe there is a difference. There is: struct driver_info struct instance struct core_instance struct driver_instance struct u_boot_driver struct u_boot_core Anyway I'll leave that alone for now. There seems to be a lot of boilerplate code about. For example the bind/unbind methods just call a core_...() function and it seems that the core library could do this itself. It seems to me that some of the methods could be NULL for most drivers, and that would reduce the porting effort. If we do this I would like to build in device tree from the start so that on boards that use CONFIG_OF_CONTROL there is no need for static data. I think the existing 'demo' driver is a really good idea since it gives people something to copy. The driver model has one fundamental flaw -- when used with SPL (where you usually have one single device for everything), it's not optimized away and only brings in overhead. That's why I'd love to see some more work put into this. Another thing that comes to mind are those .bind()/.unbind() calls which make porting drivers from Linux harder. Yet they make sense as they produce an in- memory representation of the driver tree without starting the hardware. Another thing I never understood that Pavel mentioned is that sometimes the hardware must be started so that .bind() can be successfully finished. This was probably since it is sometimes uncertain to which cores the hardware can provide services. btw. building in DT from the start would be a nice idea. I'd say we should re- think the design first and maybe align it a bit more with Linux kernel. Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] flash: Add optional verify-after-write feature
On 04.04.2013 15:53, Stefan Roese wrote: Sometimes it might make sense to verify the written data to NOR flash. This patch adds this feature. To enable this verify-after-write, you need to define CONFIG_FLASH_VERIFY in your board config header. Please note that this option is useless in nearly all cases, since such flash programming errors usually are detected earlier while unprotecting/erasing/programming. Please only enable this option if you really know what you are doing. Signed-off-by: Stefan Roese s...@denx.de Applied to u-boot-cfi-flash/master. Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Please pull u-boot-cfi-flash/master
Hi Tom, please pull the following patch: The following changes since commit d10f68ae47b67acab8b110b5c605dde4197a1820: Prepare v2013.04 (2013-04-19 10:25:43 -0400) are available in the git repository at: git://www.denx.de/git/u-boot-cfi-flash.git master for you to fetch changes up to 352ef3f1b613cb711c51ec962d2cc1eafff1bf95: flash: Add optional verify-after-write feature (2013-04-22 10:56:38 +0200) Stefan Roese (1): flash: Add optional verify-after-write feature README | 9 + common/flash.c | 11 +++ 2 files changed, 20 insertions(+) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Add NanoBone board support
On 16/04/13 20:22, Tom Rini wrote: On Tue, Apr 16, 2013 at 08:14:13PM +0100, Mark Jackson wrote: On 16/04/13 16:48, Tom Rini wrote: On Tue, Apr 16, 2013 at 04:02:34PM +0100, Mark Jackson wrote: snip +static struct cpsw_platform_data cpsw_data = { + .mdio_base = CPSW_MDIO_BASE, + .cpsw_base = CPSW_BASE, + .mdio_div = 0xff, + .channels = 8, + .cpdma_reg_ofs = 0x800, + .slaves = 2, Is this all that was needed for both interfaces to work in U-Boot, along with a config change or two? If so, I should take a stab at getting both working on the EVM-SK. Yes ... the config change is just to set CONFIG_PHY_ADDR to the correct value. Unfortunately, since the CONFIG_PHY_ADDR value is hard-coded into quite a bit of the uboot code, to change ports, you need to re-compile !! Not ideal, and I don't suppose it's too much work to get both working together, but I don't see much demand for it. Ah, so it's not quite right :( Other platforms support multiple interfaces, but I don't know how they're setup. Tom I can see in drivers/net/cpsw.c:- static int cpsw_phy_init(struct eth_device *dev, struct cpsw_slave *slave) { ... phydev = phy_connect(priv-bus, CONFIG_PHY_ADDR, dev, slave-data-phy_if); ... } As you can see the hardcoded CONFIG_PHY_ADDR is being used, despite the fact that it might be different for each slave. Could you just replace that with slave-data-phy_id ? I'll give it a try and see what happens. Cheers Mark J. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/3] cm-t35: move cm-t35 to live in compulab directory
Currently the cm-t35 support code lives under board/cm_t35 directory. Some of the code can be shared with other/future CompuLab boards, so move the cm-t35 to live under board/compulab/cm_t35 directory. Signed-off-by: Igor Grinberg grinb...@compulab.co.il Tested-by: Nikita Kiryanov nik...@compulab.co.il --- board/{ = compulab}/cm_t35/Makefile | 12 +++- board/{ = compulab}/cm_t35/cm_t35.c |2 +- board/{ = compulab}/cm_t35/display.c |2 +- board/{ = compulab}/cm_t35/eeprom.c |0 board/{ = compulab}/cm_t35/eeprom.h |0 board/{ = compulab}/cm_t35/leds.c|3 +-- boards.cfg|2 +- 7 files changed, 11 insertions(+), 10 deletions(-) rename board/{ = compulab}/cm_t35/Makefile (82%) rename board/{ = compulab}/cm_t35/cm_t35.c (99%) rename board/{ = compulab}/cm_t35/display.c (99%) rename board/{ = compulab}/cm_t35/eeprom.c (100%) rename board/{ = compulab}/cm_t35/eeprom.h (100%) rename board/{ = compulab}/cm_t35/leds.c (95%) diff --git a/board/cm_t35/Makefile b/board/compulab/cm_t35/Makefile similarity index 82% rename from board/cm_t35/Makefile rename to board/compulab/cm_t35/Makefile index bde56e6..31d9bbb 100644 --- a/board/cm_t35/Makefile +++ b/board/compulab/cm_t35/Makefile @@ -1,6 +1,8 @@ # -# (C) Copyright 2000, 2001, 2002 -# Wolfgang Denk, DENX Software Engineering, w...@denx.de. +# (C) Copyright 2011 - 2013 CompuLab, Ltd. www.compulab.co.il +# +# Authors: Nikita Kiryanov nik...@compulab.co.il +# Igor Grinberg grinb...@compulab.co.il # # See file CREDITS for list of people who contributed to this # project. @@ -17,9 +19,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307 USA -# +# Foundation, Inc. include $(TOPDIR)/config.mk @@ -42,3 +42,5 @@ $(LIB): $(obj).depend $(OBJS) include $(SRCTREE)/rules.mk sinclude $(obj).depend + +# diff --git a/board/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c similarity index 99% rename from board/cm_t35/cm_t35.c rename to board/compulab/cm_t35/cm_t35.c index 84c36ba..1b96c7e 100644 --- a/board/cm_t35/cm_t35.c +++ b/board/compulab/cm_t35/cm_t35.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2011 CompuLab, Ltd. www.compulab.co.il + * (C) Copyright 2011 - 2013 CompuLab, Ltd. www.compulab.co.il * * Authors: Mike Rapoport m...@compulab.co.il * Igor Grinberg grinb...@compulab.co.il diff --git a/board/cm_t35/display.c b/board/compulab/cm_t35/display.c similarity index 99% rename from board/cm_t35/display.c rename to board/compulab/cm_t35/display.c index a004ea1..adc4853 100644 --- a/board/cm_t35/display.c +++ b/board/compulab/cm_t35/display.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2012 CompuLab, Ltd. www.compulab.co.il + * (C) Copyright 2012 - 2013 CompuLab, Ltd. www.compulab.co.il * * Authors: Nikita Kiryanov nik...@compulab.co.il * diff --git a/board/cm_t35/eeprom.c b/board/compulab/cm_t35/eeprom.c similarity index 100% rename from board/cm_t35/eeprom.c rename to board/compulab/cm_t35/eeprom.c diff --git a/board/cm_t35/eeprom.h b/board/compulab/cm_t35/eeprom.h similarity index 100% rename from board/cm_t35/eeprom.h rename to board/compulab/cm_t35/eeprom.h diff --git a/board/cm_t35/leds.c b/board/compulab/cm_t35/leds.c similarity index 95% rename from board/cm_t35/leds.c rename to board/compulab/cm_t35/leds.c index 48ad598..dcae135 100644 --- a/board/cm_t35/leds.c +++ b/board/compulab/cm_t35/leds.c @@ -1,6 +1,5 @@ /* - * (C) Copyright 2011 - * CompuLab, Ltd. www.compulab.co.il + * (C) Copyright 2011 - 2013 CompuLab, Ltd. www.compulab.co.il * * Author: Igor Grinberg grinb...@compulab.co.il * diff --git a/boards.cfg b/boards.cfg index 31483d6..e2bb484 100644 --- a/boards.cfg +++ b/boards.cfg @@ -268,10 +268,10 @@ nitrogen6s arm armv7 nitrogen6x boundar nitrogen6s1g arm armv7 nitrogen6x boundary mx6 nitrogen6x:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s1g.cfg,MX6S,DDR_MB=1024 wandboard_dlarm armv7 wandboard - mx6 wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6dl.cfg,MX6DL,DDR_MB=1024 wandboard_solo arm armv7 wandboard - mx6 wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s.cfg,MX6S,DDR_MB=512 -cm_t35 arm armv7 cm_t35 - omap3 omap3_overo arm armv7 overo - omap3 omap3_pandoraarm armv7 pandora - omap3 dig297 arm armv7 dig297 comelitomap3 +cm_t35 arm
[U-Boot] [PATCH 3/3] cm-t35: update config file
Several minor updates to the cm-t35 config file. Signed-off-by: Igor Grinberg grinb...@compulab.co.il Tested-by: Nikita Kiryanov nik...@compulab.co.il --- include/configs/cm_t35.h | 18 +- 1 files changed, 5 insertions(+), 13 deletions(-) diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h index 726714d..c6e357a 100644 --- a/include/configs/cm_t35.h +++ b/include/configs/cm_t35.h @@ -135,12 +135,12 @@ #define CONFIG_CMD_CACHE #define CONFIG_CMD_EXT2/* EXT2 Support */ #define CONFIG_CMD_FAT /* FAT support */ -#define CONFIG_CMD_JFFS2 /* JFFS2 Support*/ #define CONFIG_CMD_MTDPARTS/* Enable MTD parts commands */ #define CONFIG_MTD_DEVICE /* needed for mtdparts commands */ +#define CONFIG_MTD_PARTITIONS #define MTDIDS_DEFAULT nand0=nand #define MTDPARTS_DEFAULT mtdparts=nand:512k(x-loader),\ - 1920k(u-boot),128k(u-boot-env),\ + 1920k(u-boot),256k(u-boot-env),\ 4m(kernel),-(fs) #define CONFIG_CMD_I2C /* I2C serial bus support */ @@ -182,14 +182,6 @@ #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND */ /* devices */ -#define CONFIG_JFFS2_NAND -/* nand device jffs2 lives on */ -#define CONFIG_JFFS2_DEV nand0 -/* start of jffs2 partition */ -#define CONFIG_JFFS2_PART_OFFSET 0x68 -#define CONFIG_JFFS2_PART_SIZE 0xf98 /* size of jffs2 */ - /* partition */ - /* Environment information */ #define CONFIG_BOOTDELAY 10 #define CONFIG_ZERO_BOOTDELAY_CHECK @@ -204,9 +196,9 @@ defaultdisplay=dvi\0 \ mmcdev=0\0 \ mmcroot=/dev/mmcblk0p2 rw\0 \ - mmcrootfstype=ext3 rootwait\0 \ + mmcrootfstype=ext4 rootwait\0 \ nandroot=/dev/mtdblock4 rw\0 \ - nandrootfstype=jffs2\0 \ + nandrootfstype=ubifs\0 \ mmcargs=setenv bootargs console=${console} \ mpurate=${mpurate} \ vram=${vram} \ @@ -232,7 +224,7 @@ bootm ${loadaddr}\0 \ nandboot=echo Booting from nand ...; \ run nandargs; \ - nand read ${loadaddr} 28 40; \ + nand read ${loadaddr} 2a 40; \ bootm ${loadaddr}\0 \ #define CONFIG_BOOTCOMMAND \ -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/3] MAINTAINERS: fix the cm-t35 board name
cm-t35 in U-Boot source code is called cm_t35. Make the change cm-t35 - cm_t35 for better greppability. Signed-off-by: Igor Grinberg grinb...@compulab.co.il --- MAINTAINERS |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 643a5ac..8e707d5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -683,7 +683,7 @@ Simon Guinot simon.gui...@sequanux.org Igor Grinberg grinb...@compulab.co.il - cm-t35 ARM ARMV7 (OMAP3xx Soc) + cm_t35 ARM ARMV7 (OMAP3xx Soc) Stefan Herbrechtsmeier ste...@code.herbrechtsmeier.net -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 4/6] Add Atmel I2C tpm
Add support for Atmel TPM devices with two wire interface. Signed-off-by: Dirk Eibach eib...@gdsys.de Signed-off-by: Reinhard Pfau p...@gdsys.de --- README |6 +++ drivers/tpm/Makefile|1 + drivers/tpm/atmel_twi_tpm.c | 119 +++ 3 files changed, 126 insertions(+) create mode 100644 drivers/tpm/atmel_twi_tpm.c diff --git a/README b/README index 58b2ee5..2053931 100644 --- a/README +++ b/README @@ -1201,6 +1201,12 @@ The following options need to be configured: If this option is set, the driver enables cache flush. - TPM Support: + Only one TPM device per system is supported at this time. + So enable only one of the supported devices. + + CONFIG_ATMEL_TWI_TPM + Support for Atmel TWI TPM device. Requires I2C support. + CONFIG_GENERIC_LPC_TPM Support for generic parallel port TPM devices. Only one device per system is supported at this time. diff --git a/drivers/tpm/Makefile b/drivers/tpm/Makefile index e8c159c..5c8f246 100644 --- a/drivers/tpm/Makefile +++ b/drivers/tpm/Makefile @@ -28,6 +28,7 @@ $(shell mkdir -p $(obj)slb9635_i2c) COBJS-$(CONFIG_GENERIC_LPC_TPM) = generic_lpc_tpm.o COBJS-$(CONFIG_INFINEON_TPM_I2C) += tis_i2c.o slb9635_i2c/tpm.o COBJS-$(CONFIG_INFINEON_TPM_I2C) += slb9635_i2c/tpm_tis_i2c.o +COBJS-$(CONFIG_ATMEL_TWI_TPM) = atmel_twi_tpm.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/tpm/atmel_twi_tpm.c b/drivers/tpm/atmel_twi_tpm.c new file mode 100644 index 000..1fa626f --- /dev/null +++ b/drivers/tpm/atmel_twi_tpm.c @@ -0,0 +1,119 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include common.h +#include tpm.h +#include i2c.h +#include asm/unaligned.h + +#undef DEBUG_ATMEL_TWI_TPM +#ifdef DEBUG +#define DEBUG_ATMEL_TWI_TPM +#endif + + +/* + * tis_init() + * + * Initialize the TPM device. Returns 0 on success or -1 on + * failure (in case device probing did not succeed). + */ +int tis_init(void) +{ + return 0; +} + +/* + * tis_open() + * + * Requests access to locality 0 for the caller. After all commands have been + * completed the caller is supposed to call tis_close(). + * + * Returns 0 on success, -1 on failure. + */ +int tis_open(void) +{ + return 0; +} + +/* + * tis_close() + * + * terminate the currect session with the TPM by releasing the locked + * locality. Returns 0 on success of -1 on failure (in case lock + * removal did not succeed). + */ +int tis_close(void) +{ + return 0; +} + +/* + * tis_sendrecv() + * + * Send the requested data to the TPM and then try to get its response + * + * @sendbuf - buffer of the data to send + * @send_size size of the data to send + * @recvbuf - memory to save the response to + * @recv_len - pointer to the size of the response buffer + * + * Returns 0 on success (and places the number of response bytes at recv_len) + * or -1 on failure. + */ +int tis_sendrecv(const uint8_t *sendbuf, size_t send_size, uint8_t *recvbuf, + size_t *recv_len) +{ + int res; + +#ifdef DEBUG_ATMEL_TWI_TPM + memset(recvbuf, 0xcc, *recv_len); + printf(send to TPM (%d bytes, recv_len=%d):\n, send_size, *recv_len); + print_buffer(0, (void *)sendbuf, 1, send_size, 0); +#endif + + res = i2c_write(0x29, 0, 0, (uchar *)sendbuf, send_size); + if (res) { + printf(i2c_write returned %d\n, res); + return -1; + } + + mdelay(1); + /* TODO timeout for the loop?! */ + while ((res = i2c_read(0x29, 0, 0, recvbuf, 10))) + udelay(100); + if (!res) { + *recv_len = get_unaligned_be32(recvbuf + 2); + if (*recv_len 10) + res = i2c_read(0x29, 0, 0, recvbuf, *recv_len); + } + if (res) { + printf(i2c_read returned %d (rlen=%d)\n, res, *recv_len); +#ifdef DEBUG_ATMEL_TWI_TPM + print_buffer(0, recvbuf, 1, *recv_len, 0); +#endif + } + +#ifdef DEBUG_ATMEL_TWI_TPM + if (!res) { + printf(read from TPM (%d bytes):\n, *recv_len); + print_buffer(0, recvbuf, 1, *recv_len, 0); + } +#endif + + return
[U-Boot] [PATCH 5/6] powerpc: Build arch/powerpc/lib/bootm.o depending on CONFIG_CMD_BOOTM
Signed-off-by: Dirk Eibach eib...@gdsys.de --- arch/powerpc/lib/Makefile |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index 59c723b..8c4920b 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile @@ -63,7 +63,7 @@ ifndef CONFIG_SYS_GENERIC_BOARD COBJS-y+= board.o endif endif -COBJS-y+= bootm.o +COBJS-$(CONFIG_CMD_BOOTM) += bootm.o COBJS-y+= cache.o COBJS-y+= extable.o COBJS-y+= interrupts.o -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/6] i2c: fsl_i2c: i2c_read(): dont try to write address w/ alen=0
From: Reinhard Pfau p...@gdsys.de if alen is 0: no longer start a write cycle before reading data. Signed-off-by: Dirk Eibach eib...@gdsys.de Signed-off-by: Reinhard Pfau p...@gdsys.de --- drivers/i2c/fsl_i2c.c |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c index 1c7265d..276386d 100644 --- a/drivers/i2c/fsl_i2c.c +++ b/drivers/i2c/fsl_i2c.c @@ -383,13 +383,16 @@ i2c_read(u8 dev, uint addr, int alen, u8 *data, int length) int i = -1; /* signal error */ u8 *a = (u8*)addr; - if (i2c_wait4bus() = 0 + if (i2c_wait4bus() 0) + return -1; + + if (alen 0 i2c_write_addr(dev, I2C_WRITE_BIT, 0) != 0 __i2c_write(a[4 - alen], alen) == alen) i = 0; /* No error so far */ if (length -i2c_write_addr(dev, I2C_READ_BIT, 1) != 0) +i2c_write_addr(dev, I2C_READ_BIT, alen ? 1 : 0) != 0) i = __i2c_read(data, length); writeb(I2C_CR_MEN, i2c_dev[i2c_bus_num]-cr); -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/6] mpc85xx: Add CONFIG_RELEASE_CORE0_ONLY
If CONFIG_RELEASE_CORE0_ONLY is set, all cores except core0 are kept in holdoff mode. Signed-off-by: Dirk Eibach eib...@gdsys.de --- arch/powerpc/cpu/mpc85xx/mp.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/mp.c b/arch/powerpc/cpu/mpc85xx/mp.c index 43d4836..73c1024 100644 --- a/arch/powerpc/cpu/mpc85xx/mp.c +++ b/arch/powerpc/cpu/mpc85xx/mp.c @@ -350,7 +350,11 @@ static void plat_mp_up(unsigned long bootpg, unsigned int pagesize) volatile ccsr_pic_t *pic = (void *)(CONFIG_SYS_MPC8xxx_PIC_ADDR); u32 devdisr; int timeout = 10; + int numcores = 1; +#ifndef CONFIG_RELEASE_CORE0_ONLY + numcores = cpu_numcores(); +#endif whoami = in_be32(pic-whoami); out_be32(ecm-bptr, 0x8000 | (bootpg 12)); @@ -363,7 +367,7 @@ static void plat_mp_up(unsigned long bootpg, unsigned int pagesize) out_be32(gur-devdisr, devdisr); /* release the hounds */ - up = ((1 cpu_numcores()) - 1); + up = ((1 numcores) - 1); bpcr = in_be32(ecm-eebpcr); bpcr |= (up 24); out_be32(ecm-eebpcr, bpcr); @@ -373,7 +377,7 @@ static void plat_mp_up(unsigned long bootpg, unsigned int pagesize) /* wait for everyone */ while (timeout) { int i; - for (i = 0; i cpu_numcores(); i++) { + for (i = 0; i numcores; i++) { if (table[i * NUM_BOOT_ENTRY + BOOT_ENTRY_ADDR_LOWER]) cpu_up_mask |= (1 i); }; -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/6] Add gdsys ControlCenter Digital board
Dirk Eibach (4): mpc85xx: Add CONFIG_RELEASE_CORE0_ONLY Add Atmel I2C tpm powerpc: Build arch/powerpc/lib/bootm.o depending on CONFIG_CMD_BOOTM mpc85xx: Add gdsys ControlCenter Digital board Reinhard Pfau (2): tpm: add AUTH1 cmds for LoadKey2 and GetPubKey i2c: fsl_i2c: i2c_read(): dont try to write address w/ alen=0 README| 20 + arch/powerpc/cpu/mpc85xx/mp.c |8 +- arch/powerpc/lib/Makefile |2 +- board/gdsys/common/Makefile |1 + board/gdsys/common/dp501.c| 107 +++ board/gdsys/common/dp501.h| 30 + board/gdsys/p1022/Makefile| 37 + board/gdsys/p1022/controlcenterd-id.c | 1205 + board/gdsys/p1022/controlcenterd-id.h | 29 + board/gdsys/p1022/controlcenterd.c| 447 board/gdsys/p1022/ddr.c | 71 ++ board/gdsys/p1022/diu.c | 87 +++ board/gdsys/p1022/law.c | 20 + board/gdsys/p1022/sdhc_boot.c | 63 ++ board/gdsys/p1022/tlb.c | 77 +++ boards.cfg|7 + common/cmd_tpm.c | 93 +++ drivers/i2c/fsl_i2c.c |7 +- drivers/tpm/Makefile |1 + drivers/tpm/atmel_twi_tpm.c | 119 include/configs/controlcenterd.h | 510 ++ include/tpm.h | 174 + lib/tpm.c | 348 +- 23 files changed, 3457 insertions(+), 6 deletions(-) create mode 100644 board/gdsys/common/dp501.c create mode 100644 board/gdsys/common/dp501.h create mode 100644 board/gdsys/p1022/Makefile create mode 100644 board/gdsys/p1022/controlcenterd-id.c create mode 100644 board/gdsys/p1022/controlcenterd-id.h create mode 100644 board/gdsys/p1022/controlcenterd.c create mode 100644 board/gdsys/p1022/ddr.c create mode 100644 board/gdsys/p1022/diu.c create mode 100644 board/gdsys/p1022/law.c create mode 100644 board/gdsys/p1022/sdhc_boot.c create mode 100644 board/gdsys/p1022/tlb.c create mode 100644 drivers/tpm/atmel_twi_tpm.c create mode 100644 include/configs/controlcenterd.h -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/6] tpm: add AUTH1 cmds for LoadKey2 and GetPubKey
From: Reinhard Pfau p...@gdsys.de Extend the tpm library with support for single authorized (AUTH1) commands as specified in the TCG Main Specification 1.2. (The internally used helper functions are implemented in a way that they could also be used for double authorized commands if someone needs it.) Provide enums with the return codes from the TCG Main specification. For now only a single OIAP session is supported. OIAP authorized version of the commands TPM_LoadKey2 and TPM_GetPubKey are provided. Both features are available using the 'tpm' command, too. Authorized commands are enabled with CONFIG_TPM_AUTH_SESSIONS. (Note that this also requires CONFIG_SHA1 to be enabled.) Signed-off-by: Reinhard Pfau p...@gdsys.de Signed-off-by: Dirk Eibach eib...@gdsys.de --- README | 14 +++ common/cmd_tpm.c | 93 +++ include/tpm.h| 174 +++ lib/tpm.c| 348 +- 4 files changed, 628 insertions(+), 1 deletion(-) diff --git a/README b/README index 0bc0af5..58b2ee5 100644 --- a/README +++ b/README @@ -1210,6 +1210,20 @@ The following options need to be configured: to. Contemporary x86 systems usually map it at 0xfed4. + CONFIG_CMD_TPM + Add tpm monitor functions. + Requires CONFIG_TPM. If CONFIG_TPM_AUTH_SESSIONS is set, also + provides monitor access to authorized functions. + + CONFIG_TPM + Define this to enable the TPM support library which provides + functional interfaces to some TPM commands. + Requires support for a TPM device. + + CONFIG_TPM_AUTH_SESSIONS + Define this to enable authorized functions in the TPM library. + Requires CONFIG_TPM and CONFIG_SHA1. + - USB Support: At the moment only the UHCI host controller is supported (PIP405, MIP405, MPC5200); define diff --git a/common/cmd_tpm.c b/common/cmd_tpm.c index 46fae18..c8767a4 100644 --- a/common/cmd_tpm.c +++ b/common/cmd_tpm.c @@ -546,6 +546,72 @@ static int do_tpm_nv_write(cmd_tbl_t *cmdtp, int flag, return convert_return_code(err); } +#ifdef CONFIG_TPM_AUTH_SESSIONS + +static int do_tpm_oiap(cmd_tbl_t *cmdtp, int flag, + int argc, char * const argv[]) +{ + uint32_t auth_handle, err; + + err = tpm_oiap(auth_handle); + + return convert_return_code(err); +} + +static int do_tpm_load_key2_oiap(cmd_tbl_t *cmdtp, int flag, + int argc, char * const argv[]) +{ + uint32_t parent_handle, key_len, key_handle, err; + uint8_t usage_auth[20]; + void *key; + + if (argc 5) + return CMD_RET_USAGE; + + parent_handle = simple_strtoul(argv[1], NULL, 0); + key = (void *)simple_strtoul(argv[2], NULL, 0); + key_len = simple_strtoul(argv[3], NULL, 0); + if (strlen(argv[4]) != 40) + return CMD_RET_FAILURE; + parse_byte_string(argv[4], usage_auth, NULL); + + err = tpm_load_key2_oiap(parent_handle, key, key_len, usage_auth, + key_handle); + if (!err) + printf(Key handle is 0x%x\n, key_handle); + + return convert_return_code(err); +} + +static int do_tpm_get_pub_key_oiap(cmd_tbl_t *cmdtp, int flag, + int argc, char * const argv[]) +{ + uint32_t key_handle, err; + uint8_t usage_auth[20]; + uint8_t pub_key_buffer[288]; + size_t pub_key_len = sizeof(pub_key_buffer); + + if (argc 3) + return CMD_RET_USAGE; + + key_handle = simple_strtoul(argv[1], NULL, 0); + if (strlen(argv[2]) != 40) + return CMD_RET_FAILURE; + parse_byte_string(argv[2], usage_auth, NULL); + + err = tpm_get_pub_key_oiap(key_handle, usage_auth, + pub_key_buffer, pub_key_len); + if (!err) { + printf(dump of received pub key structure:\n); + print_byte_string(pub_key_buffer, pub_key_len); + } + return convert_return_code(err); +} + +TPM_COMMAND_NO_ARG(tpm_end_oiap) + +#endif /* CONFIG_TPM_AUTH_SESSIONS */ + #define MAKE_TPM_CMD_ENTRY(cmd) \ U_BOOT_CMD_MKENT(cmd, 0, 1, do_tpm_ ## cmd, , ) @@ -590,6 +656,16 @@ static cmd_tbl_t tpm_commands[] = { do_tpm_nv_read, , ), U_BOOT_CMD_MKENT(nv_write, 0, 1, do_tpm_nv_write, , ), +#ifdef CONFIG_TPM_AUTH_SESSIONS + U_BOOT_CMD_MKENT(oiap, 0, 1, + do_tpm_oiap, , ), + U_BOOT_CMD_MKENT(end_oiap, 0, 1, + do_tpm_end_oiap, , ), + U_BOOT_CMD_MKENT(load_key2_oiap, 0, 1, + do_tpm_load_key2_oiap, , ), + U_BOOT_CMD_MKENT(get_pub_key_oiap, 0, 1, + do_tpm_get_pub_key_oiap, , ), +#endif /*
[U-Boot] [PATCH 01/11] powerpc/ppc4xx: Add generic accessor functions for gdsys FPGA
A set of accessor functions was added to be able to access not only memory mapped FPGA in a generic way. Signed-off-by: Dirk Eibach eib...@gdsys.de --- include/gdsys_fpga.h |5 + 1 file changed, 5 insertions(+) diff --git a/include/gdsys_fpga.h b/include/gdsys_fpga.h index 1758d74..c12a31d 100644 --- a/include/gdsys_fpga.h +++ b/include/gdsys_fpga.h @@ -32,9 +32,14 @@ enum { FPGA_STATE_PLATFORM = 1 2, }; +#define REG(reg) offsetof(struct ihs_fpga, reg) + int get_fpga_state(unsigned dev); void print_fpga_state(unsigned dev); +void fpga_set_reg(unsigned int fpga, u16 reg, u16 data); +u16 fpga_get_reg(unsigned int fpga, u16 reg); + struct ihs_gpio { u16 read; u16 clear; -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/11] Update gdsys ppc4xx-based boards
Dirk Eibach (11): powerpc/ppc4xx: Add generic accessor functions for gdsys FPGA powerpc/ppc4xx: Add gdsys mclink interface powerpc/ppc4xx: Add fpgad command for dumping gdsys fpga registers powerpc/ppc4xx: Add bitbang i2c interface for gdsys boards powerpc/ppc4xx: Use generic FPGA accessors in gdsys common code powerpc/ppc4xx: Support gdsys multichannel iocon hardware powerpc/ppc4xx: Use generic FPGA accessors on all gdsys 405ep/ex boards powerpc/ppc4xx: Fixup phy erratum on gdsys iocon hardware powerpc/ppc4xx: Increase timeout for gdsys mclink bus startup powerpc/ppc4xx: Consider gdsys FPGA OSD size powerpc/ppc4xx: Remove CONFIG_SYS_FLASH_PROTECTION from gdsys boards board/gdsys/405ep/405ep.c| 12 +- board/gdsys/405ep/dlvision-10g.c | 20 +- board/gdsys/405ep/io.c | 20 +- board/gdsys/405ep/iocon.c| 467 ++ board/gdsys/405ep/neo.c | 17 +- board/gdsys/405ex/405ex.c| 14 +- board/gdsys/405ex/io64.c | 38 ++-- board/gdsys/common/Makefile |2 +- board/gdsys/common/bb_i2c.c | 304 + board/gdsys/common/bb_i2c.h | 76 +++ board/gdsys/common/cmd_fpga.c| 94 board/gdsys/common/mclink.c | 142 board/gdsys/common/mclink.h | 31 +++ board/gdsys/common/osd.c | 105 + include/configs/dlvision-10g.h |3 +- include/configs/dlvision.h |3 +- include/configs/io.h |3 +- include/configs/iocon.h | 43 ++-- include/configs/neo.h|3 +- include/gdsys_fpga.h | 20 +- 20 files changed, 1249 insertions(+), 168 deletions(-) create mode 100644 board/gdsys/common/bb_i2c.c create mode 100644 board/gdsys/common/bb_i2c.h create mode 100644 board/gdsys/common/cmd_fpga.c create mode 100644 board/gdsys/common/mclink.c create mode 100644 board/gdsys/common/mclink.h -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 02/11] powerpc/ppc4xx: Add gdsys mclink interface
mclink is a serial interface for communication between gdsys FPGA. Signed-off-by: Dirk Eibach eib...@gdsys.de --- board/gdsys/common/Makefile |2 +- board/gdsys/common/mclink.c | 140 +++ board/gdsys/common/mclink.h | 31 ++ 3 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 board/gdsys/common/mclink.c create mode 100644 board/gdsys/common/mclink.h diff --git a/board/gdsys/common/Makefile b/board/gdsys/common/Makefile index 05dd65d..6f09550 100644 --- a/board/gdsys/common/Makefile +++ b/board/gdsys/common/Makefile @@ -31,7 +31,7 @@ LIB = $(obj)lib$(VENDOR).o COBJS-$(CONFIG_IO) += miiphybb.o COBJS-$(CONFIG_IO64) += miiphybb.o -COBJS-$(CONFIG_IOCON) += osd.o +COBJS-$(CONFIG_IOCON) += osd.o mclink.o COBJS-$(CONFIG_DLVISION_10G) += osd.o COBJS := $(COBJS-y) diff --git a/board/gdsys/common/mclink.c b/board/gdsys/common/mclink.c new file mode 100644 index 000..6c86145 --- /dev/null +++ b/board/gdsys/common/mclink.c @@ -0,0 +1,140 @@ +/* + * (C) Copyright 2012 + * Dirk Eibach, Guntermann Drunck GmbH, eib...@gdsys.de + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include common.h +#include asm/io.h +#include errno.h + +#include gdsys_fpga.h + +enum { + MCINT_SLAVE_LINK_CHANGED_EV = 1 7, + MCINT_TX_ERROR_EV = 1 9, + MCINT_TX_BUFFER_FREE = 1 10, + MCINT_TX_PACKET_TRANSMITTED_EV = 1 11, + MCINT_RX_ERROR_EV = 1 13, + MCINT_RX_CONTENT_AVAILABLE = 1 14, + MCINT_RX_PACKET_RECEIVED_EV = 1 15, +}; + +int mclink_probe(void) +{ + unsigned int k; + unsigned int ctr = 0; + int slaves = 0; + + for (k = 0; k CONFIG_SYS_MCLINK_MAX; ++k) { + int timeout = 0; + + if (!(fpga_get_reg(k, REG(mc_status)) (1 15))) + break; + + fpga_set_reg(k, REG(mc_control), 0x8000); + + while (!(fpga_get_reg(k, REG(mc_status)) (1 14))) { + udelay(100); + if (ctr++ 3) { + timeout = 1; + break; + } + } + if (timeout) + break; + + slaves++; + } + + return slaves; +} + +int mclink_send(u8 slave, u16 addr, u16 data) +{ + unsigned int ctr = 0; + u16 int_status; + u16 rx_cmd_status; + u16 rx_cmd; + + /* reset interrupt status */ + int_status = fpga_get_reg(0, REG(mc_int)); + fpga_set_reg(0, REG(mc_int), int_status); + + /* send */ + fpga_set_reg(0, REG(mc_tx_address), addr); + fpga_set_reg(0, REG(mc_tx_data), data); + fpga_set_reg(0, REG(mc_tx_cmd), (slave 0x03) 14); + fpga_set_reg(0, REG(mc_control), 0x8001); + + /* wait for reply */ + while (!(fpga_get_reg(0, REG(mc_int)) MCINT_RX_PACKET_RECEIVED_EV)) { + udelay(100); + if (ctr++ 3) + return -ETIMEDOUT; + } + + rx_cmd_status = fpga_get_reg(0, REG(mc_rx_cmd_status)); + rx_cmd = (rx_cmd_status 12) 0x03; + if (rx_cmd != 0) + printf(mclink_send: received cmd %d, expected %d\n, rx_cmd, + 0); + + return 0; +} + +int mclink_receive(u8 slave, u16 addr, u16 *data) +{ + u16 rx_cmd_status; + u16 rx_cmd; + unsigned int ctr = 0; + + /* send read request */ + fpga_set_reg(0, REG(mc_tx_address), addr); + fpga_set_reg(0, REG(mc_tx_cmd), +((slave 0x03) 14) | (1 12) | (1 0)); + fpga_set_reg(0, REG(mc_control), 0x8001); + + /* wait for reply */ + while (!(fpga_get_reg(0, REG(mc_int)) MCINT_RX_CONTENT_AVAILABLE)) { + udelay(100); + if (ctr++ 3) + return -ETIMEDOUT; + } + + /* check reply */ + rx_cmd_status = fpga_get_reg(0, REG(mc_rx_cmd_status)); + if ((rx_cmd_status 14) != slave) { + printf(mclink_receive: reply from slave %d, expected %d\n, + rx_cmd_status 14, slave); + return -EINVAL; + } + + rx_cmd =
[U-Boot] [PATCH 03/11] powerpc/ppc4xx: Add fpgad command for dumping gdsys fpga registers
Signed-off-by: Dirk Eibach eib...@gdsys.de --- board/gdsys/common/Makefile |2 +- board/gdsys/common/cmd_fpga.c | 94 + 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 board/gdsys/common/cmd_fpga.c diff --git a/board/gdsys/common/Makefile b/board/gdsys/common/Makefile index 6f09550..aa15c15 100644 --- a/board/gdsys/common/Makefile +++ b/board/gdsys/common/Makefile @@ -31,7 +31,7 @@ LIB = $(obj)lib$(VENDOR).o COBJS-$(CONFIG_IO) += miiphybb.o COBJS-$(CONFIG_IO64) += miiphybb.o -COBJS-$(CONFIG_IOCON) += osd.o mclink.o +COBJS-$(CONFIG_IOCON) += osd.o mclink.o cmd_fpga.o COBJS-$(CONFIG_DLVISION_10G) += osd.o COBJS := $(COBJS-y) diff --git a/board/gdsys/common/cmd_fpga.c b/board/gdsys/common/cmd_fpga.c new file mode 100644 index 000..b73e599 --- /dev/null +++ b/board/gdsys/common/cmd_fpga.c @@ -0,0 +1,94 @@ +/* + * (C) Copyright 2012 + * Dirk Eibach, Guntermann Drunck GmbH, eib...@gdsys.de + * + * based on cmd_mem.c + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, w...@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include common.h +#include command.h + +#include gdsys_fpga.h + +static uintdp_last_fpga; +static uintdp_last_addr; +static uintdp_last_length = 0x40; + +/* Memory Display + * + * Syntax: + * fpgad {fpga} {addr} {len} + */ +#define DISP_LINE_LEN 16 +int do_fpga_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + unsigned int k; + unsigned int fpga; + ulong addr, length; + int rc = 0; + u16 linebuf[DISP_LINE_LEN/sizeof(u16)]; + + /* We use the last specified parameters, unless new ones are +* entered. +*/ +fpga = dp_last_fpga; + addr = dp_last_addr; + length = dp_last_length; + + if (argc 3) + return CMD_RET_USAGE; + + if ((flag CMD_FLAG_REPEAT) == 0) { + /* FPGA is specified since argc 2 + */ + fpga = simple_strtoul(argv[1], NULL, 16); + + /* Address is specified since argc 2 + */ + addr = simple_strtoul(argv[2], NULL, 16); + + /* If another parameter, it is the length to display. +* Length is the number of objects, not number of bytes. +*/ + if (argc 3) + length = simple_strtoul(argv[3], NULL, 16); + } + + /* Print the lines. */ + for (k = 0; k DISP_LINE_LEN / sizeof(u16); ++k) + linebuf[k] = fpga_get_reg(fpga, addr + k * sizeof(u16)); + print_buffer(addr, (void *)linebuf, sizeof(u16), +length, DISP_LINE_LEN / sizeof(u16)); + addr += sizeof(u16)*length; + + dp_last_fpga = fpga; + dp_last_addr = addr; + dp_last_length = length; + return rc; +} + +U_BOOT_CMD( + fpgad, 4, 1, do_fpga_md, + fpga register display, + fpga address [# of objects] +); -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 04/11] powerpc/ppc4xx: Add bitbang i2c interface for gdsys boards
This adds an i2c bitbang interface that can coexist with processor i2c. Signed-off-by: Dirk Eibach eib...@gdsys.de --- board/gdsys/common/Makefile |2 +- board/gdsys/common/bb_i2c.c | 304 +++ board/gdsys/common/bb_i2c.h | 76 +++ 3 files changed, 381 insertions(+), 1 deletion(-) create mode 100644 board/gdsys/common/bb_i2c.c create mode 100644 board/gdsys/common/bb_i2c.h diff --git a/board/gdsys/common/Makefile b/board/gdsys/common/Makefile index aa15c15..b217d97 100644 --- a/board/gdsys/common/Makefile +++ b/board/gdsys/common/Makefile @@ -31,7 +31,7 @@ LIB = $(obj)lib$(VENDOR).o COBJS-$(CONFIG_IO) += miiphybb.o COBJS-$(CONFIG_IO64) += miiphybb.o -COBJS-$(CONFIG_IOCON) += osd.o mclink.o cmd_fpga.o +COBJS-$(CONFIG_IOCON) += osd.o mclink.o cmd_fpga.o bb_i2c.o COBJS-$(CONFIG_DLVISION_10G) += osd.o COBJS := $(COBJS-y) diff --git a/board/gdsys/common/bb_i2c.c b/board/gdsys/common/bb_i2c.c new file mode 100644 index 000..a816514 --- /dev/null +++ b/board/gdsys/common/bb_i2c.c @@ -0,0 +1,304 @@ +/* + * (C) Copyright 2012 + * Dirk Eibach, Guntermann Drunck GmbH, eib...@gdsys.de + * + * based on soft_i2c.c + * (C) Copyright 2001, 2002 + * Wolfgang Denk, DENX Software Engineering, w...@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * This has been changed substantially by Gerald Van Baren, Custom IDEAS, + * vanba...@cideas.com. It was heavily influenced by LiMon, written by + * Neil Russell. + */ + +#include common.h + +/*--- + * Definitions + */ + +#define RETRIES0 + +#define BB_I2C_ACK 0 /* PD_SDA level to ack a byte */ +#define BB_I2C_NOACK 1 /* PD_SDA level to noack a byte */ + +/*--- + * Local functions + */ +static void send_reset(unsigned int bus); +static void send_start(unsigned int bus); +static void send_stop(unsigned int bus); +static void send_ack(unsigned int bus, int ack); +static int write_byte(unsigned int bus, uchar byte); +static uchar read_byte(unsigned int bus, int ack); + +/*--- + * Send a reset sequence consisting of 9 clocks with the data signal high + * to clock any confused device back into an idle state. Also send a + * stop at the end of the sequence for belts suspenders. + */ +static void send_reset(unsigned int bus) +{ + BB_I2C_SOFT_DECLARATIONS(bus) /* intentional without ';' */ + int j; + + BB_I2C_SCL(bus, 1); + BB_I2C_SDA(bus, 1); + BB_I2C_TRISTATE(bus); + for (j = 0; j 9; j++) { + BB_I2C_SCL(bus, 0); + BB_I2C_DELAY(bus); + BB_I2C_DELAY(bus); + BB_I2C_SCL(bus, 1); + BB_I2C_DELAY(bus); + BB_I2C_DELAY(bus); + } + send_stop(bus); + BB_I2C_TRISTATE(bus); +} + +/*--- + * START: High - Low on SDA while SCL is High + */ +static void send_start(unsigned int bus) +{ + BB_I2C_SOFT_DECLARATIONS(bus) /* intentional without ';' */ + + BB_I2C_DELAY(bus); + BB_I2C_SDA(bus, 1); + BB_I2C_ACTIVE(bus); + BB_I2C_DELAY(bus); + BB_I2C_SCL(bus, 1); + BB_I2C_DELAY(bus); + BB_I2C_SDA(bus, 0); + BB_I2C_DELAY(bus); +} + +/*--- + * STOP: Low - High on SDA while SCL is High + */ +static void send_stop(unsigned int bus) +{ + BB_I2C_SOFT_DECLARATIONS(bus) /* intentional without ';' */ + + BB_I2C_SCL(bus, 0); + BB_I2C_DELAY(bus); + BB_I2C_SDA(bus, 0); + BB_I2C_ACTIVE(bus); + BB_I2C_DELAY(bus); + BB_I2C_SCL(bus, 1); + BB_I2C_DELAY(bus); + BB_I2C_SDA(bus, 1); + BB_I2C_DELAY(bus); + BB_I2C_TRISTATE(bus); +} + +/*--- + * ack should be BB_I2C_ACK or BB_I2C_NOACK + */ +static void send_ack(unsigned int bus, int ack) +{ + BB_I2C_SOFT_DECLARATIONS(bus)
[U-Boot] [PATCH 05/11] powerpc/ppc4xx: Use generic FPGA accessors in gdsys common code
Signed-off-by: Dirk Eibach eib...@gdsys.de --- board/gdsys/405ep/405ep.c | 12 board/gdsys/common/osd.c | 70 + 2 files changed, 38 insertions(+), 44 deletions(-) diff --git a/board/gdsys/405ep/405ep.c b/board/gdsys/405ep/405ep.c index 6221171..e5fbd2e 100644 --- a/board/gdsys/405ep/405ep.c +++ b/board/gdsys/405ep/405ep.c @@ -106,22 +106,20 @@ int board_early_init_r(void) gd405ep_set_fpga_reset(0); for (k = 0; k CONFIG_SYS_FPGA_COUNT; ++k) { - struct ihs_fpga *fpga = - (struct ihs_fpga *)CONFIG_SYS_FPGA_BASE(k); #ifdef CONFIG_SYS_FPGA_NO_RFL_HI - u16 *reflection_target = fpga-reflection_low; + u16 reflection_target = REG(reflection_low); #else - u16 *reflection_target = fpga-reflection_high; + u16 reflection_target = REG(reflection_high); #endif /* * wait for fpga out of reset */ ctr = 0; while (1) { - out_le16(fpga-reflection_low, - REFLECTION_TESTPATTERN); + fpga_set_reg(k, REG(reflection_low), +REFLECTION_TESTPATTERN); - if (in_le16(reflection_target) == + if (fpga_get_reg(k, reflection_target) == REFLECTION_TESTPATTERN_INV) break; diff --git a/board/gdsys/common/osd.c b/board/gdsys/common/osd.c index a192c98..81c8136 100644 --- a/board/gdsys/common/osd.c +++ b/board/gdsys/common/osd.c @@ -22,7 +22,7 @@ */ #include common.h -#include i2c.h +#include bb_i2c.h #include asm/io.h #include gdsys_fpga.h @@ -67,37 +67,34 @@ enum { CH7301_DSP = 0x56, /* DVI Sync polarity Register */ }; +unsigned int max_osd_screen = CONFIG_SYS_OSD_SCREENS - 1; + #if defined(CONFIG_SYS_ICS8N3QV01) || defined(CONFIG_SYS_SIL1178) static void fpga_iic_write(unsigned screen, u8 slave, u8 reg, u8 data) { - struct ihs_fpga *fpga = (struct ihs_fpga *)CONFIG_SYS_FPGA_BASE(screen); - struct ihs_i2c *i2c = fpga-i2c; - - while (in_le16(fpga-extended_interrupt) (1 12)) + while (fpga_get_reg(screen, REG(extended_interrupt)) (1 12)) ; - out_le16(i2c-write_mailbox_ext, reg | (data 8)); - out_le16(i2c-write_mailbox, 0xc400 | (slave 1)); + fpga_set_reg(screen, REG(i2c.write_mailbox_ext), reg | (data 8)); + fpga_set_reg(screen, REG(i2c.write_mailbox), 0xc400 | (slave 1)); } static u8 fpga_iic_read(unsigned screen, u8 slave, u8 reg) { - struct ihs_fpga *fpga = (struct ihs_fpga *)CONFIG_SYS_FPGA_BASE(screen); - struct ihs_i2c *i2c = fpga-i2c; unsigned int ctr = 0; - while (in_le16(fpga-extended_interrupt) (1 12)) + while (fpga_get_reg(screen, REG(extended_interrupt)) (1 12)) ; - out_le16(fpga-extended_interrupt, 1 14); - out_le16(i2c-write_mailbox_ext, reg); - out_le16(i2c-write_mailbox, 0xc000 | (slave 1)); - while (!(in_le16(fpga-extended_interrupt) (1 14))) { + fpga_set_reg(screen, REG(extended_interrupt), 1 14); + fpga_set_reg(screen, REG(i2c.write_mailbox_ext), reg); + fpga_set_reg(screen, REG(i2c.write_mailbox), 0xc000 | (slave 1)); + while (!(fpga_get_reg(screen, REG(extended_interrupt)) (1 14))) { udelay(10); if (ctr++ 5) { printf(iic receive timeout\n); break; } } - return in_le16(i2c-read_mailbox_ext) 8; + return fpga_get_reg(screen, REG(i2c.read_mailbox_ext)) 8; } #endif @@ -129,7 +126,6 @@ static void mpc92469ac_calc_parameters(unsigned int fout, static void mpc92469ac_set(unsigned screen, unsigned int fout) { - struct ihs_fpga *fpga = (struct ihs_fpga *)CONFIG_SYS_FPGA_BASE(screen); unsigned int n; unsigned int m; unsigned int bitval = 0; @@ -150,7 +146,7 @@ static void mpc92469ac_set(unsigned screen, unsigned int fout) break; } - out_le16(fpga-mpc3w_control, (bitval 9) | m); + fpga_set_reg(screen, REG(mpc3w_control), (bitval 9) | m); } #endif @@ -265,14 +261,13 @@ static void ics8n3qv01_set(unsigned screen, unsigned int fout) static int osd_write_videomem(unsigned screen, unsigned offset, u16 *data, size_t charcount) { - struct ihs_fpga *fpga = - (struct ihs_fpga *) CONFIG_SYS_FPGA_BASE(screen); unsigned int k; for (k = 0; k charcount; ++k) { if (offset + k = BUFSIZE) return -1; - out_le16(fpga-videomem + offset + k, data[k]); + fpga_set_reg(screen, REG(videomem) + sizeof(u16) * (offset + k), +
[U-Boot] [PATCH 06/11] powerpc/ppc4xx: Support gdsys multichannel iocon hardware
Signed-off-by: Dirk Eibach eib...@gdsys.de --- board/gdsys/405ep/iocon.c | 253 ++--- include/configs/iocon.h | 37 --- include/gdsys_fpga.h | 15 ++- 3 files changed, 248 insertions(+), 57 deletions(-) diff --git a/board/gdsys/405ep/iocon.c b/board/gdsys/405ep/iocon.c index 0fc7db2..ece45d6 100644 --- a/board/gdsys/405ep/iocon.c +++ b/board/gdsys/405ep/iocon.c @@ -23,6 +23,7 @@ #include common.h #include command.h +#include errno.h #include asm/processor.h #include asm/io.h #include asm/ppc4xx-gpio.h @@ -31,6 +32,13 @@ #include gdsys_fpga.h #include ../common/osd.h +#include ../common/mclink.h + +#include i2c.h +#include pca953x.h +#include pca9698.h + +DECLARE_GLOBAL_DATA_PTR; #define LATCH0_BASE (CONFIG_SYS_LATCH_BASE) #define LATCH1_BASE (CONFIG_SYS_LATCH_BASE + 0x100) @@ -47,11 +55,20 @@ enum { HWVER_100 = 0, HWVER_104 = 1, HWVER_110 = 2, + HWVER_120 = 3, + HWVER_200 = 4, + HWVER_210 = 5, +}; + +enum { + FPGA_HWVER_200 = 0, + FPGA_HWVER_210 = 1, }; enum { COMPRESSION_NONE = 0, - COMPRESSION_TYPE1_DELTA, + COMPRESSION_TYPE1_DELTA = 1, + COMPRESSION_TYPE1_TYPE2_DELTA = 3, }; enum { @@ -67,8 +84,56 @@ enum { enum { RAM_DDR2_32 = 0, + RAM_DDR3_32 = 1, +}; + +enum { + MCFPGA_DONE = 1 0, + MCFPGA_INIT_N = 1 1, + MCFPGA_PROGRAM_N = 1 2, + MCFPGA_UPDATE_ENABLE_N = 1 3, + MCFPGA_RESET_N = 1 4, }; +unsigned int mclink_fpgacount; + +void fpga_set_reg(unsigned int fpga, u16 reg, u16 data) +{ + int res; + struct ihs_fpga *fpga_0 = (struct ihs_fpga *)CONFIG_SYS_FPGA_BASE(0); + + switch (fpga) { + case 0: + out_le16((u16 *)fpga_0 + reg / sizeof(u16), data); + break; + default: + res = mclink_send(fpga - 1, reg, data); + if (res 0) + printf(mclink_send reg %02x data %04x returned %d\n, + reg, data, res); + break; + } +} + +u16 fpga_get_reg(unsigned int fpga, u16 reg) +{ + int res; + u16 data; + struct ihs_fpga *fpga_0 = (struct ihs_fpga *)CONFIG_SYS_FPGA_BASE(0); + + switch (fpga) { + case 0: + return in_le16((u16 *)fpga_0 + reg / sizeof(u16)); + default: + if (fpga mclink_fpgacount) + return -EINVAL; + res = mclink_receive(fpga - 1, reg, data); + if (res 0) + printf(mclink_receive returned %d\n, res); + return data; + } +} + /* * Check Board Identity: */ @@ -90,12 +155,11 @@ int checkboard(void) return 0; } -static void print_fpga_info(void) +static void print_fpga_info(unsigned int fpga) { - struct ihs_fpga *fpga = (struct ihs_fpga *) CONFIG_SYS_FPGA_BASE(0); - u16 versions = in_le16(fpga-versions); - u16 fpga_version = in_le16(fpga-fpga_version); - u16 fpga_features = in_le16(fpga-fpga_features); + u16 versions = fpga_get_reg(fpga, REG(versions)); + u16 fpga_version = fpga_get_reg(fpga, REG(fpga_version)); + u16 fpga_features = fpga_get_reg(fpga, REG(fpga_features)); unsigned unit_type; unsigned hardware_version; unsigned feature_compression; @@ -105,9 +169,9 @@ static void print_fpga_info(void) unsigned feature_ramconfig; unsigned feature_carriers; unsigned feature_video_channels; + int legacy = get_fpga_state(0) FPGA_STATE_PLATFORM; unit_type = (versions 0xf000) 12; - hardware_version = versions 0x000f; feature_compression = (fpga_features 0xe000) 13; feature_osd = fpga_features (111); feature_audio = (fpga_features 0x0600) 9; @@ -116,6 +180,9 @@ static void print_fpga_info(void) feature_carriers = (fpga_features 0x000c) 2; feature_video_channels = fpga_features 0x0003; + if (legacy) + printf(legacy ); + switch (unit_type) { case UNITTYPE_MAIN_USER: printf(Mainchannel); @@ -130,27 +197,68 @@ static void print_fpga_info(void) break; } - switch (hardware_version) { - case HWVER_100: - printf( HW-Ver 1.00\n); - break; - - case HWVER_104: - printf( HW-Ver 1.04\n); - break; - - case HWVER_110: - printf( HW-Ver 1.10\n); - break; + if (unit_type == UNITTYPE_MAIN_USER) { + if (legacy) + hardware_version = + (in_le16((void *)LATCH2_BASE)8) 0x0f; + else + hardware_version = + (!!pca9698_get_value(0x20, 24) 0) + | (!!pca9698_get_value(0x20, 25) 1) +
[U-Boot] [PATCH 09/11] powerpc/ppc4xx: Increase timeout for gdsys mclink bus startup
Signed-off-by: Dirk Eibach eib...@gdsys.de --- board/gdsys/common/mclink.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/board/gdsys/common/mclink.c b/board/gdsys/common/mclink.c index 6c86145..641a327 100644 --- a/board/gdsys/common/mclink.c +++ b/board/gdsys/common/mclink.c @@ -40,11 +40,11 @@ enum { int mclink_probe(void) { unsigned int k; - unsigned int ctr = 0; int slaves = 0; for (k = 0; k CONFIG_SYS_MCLINK_MAX; ++k) { int timeout = 0; + unsigned int ctr = 0; if (!(fpga_get_reg(k, REG(mc_status)) (1 15))) break; @@ -53,7 +53,7 @@ int mclink_probe(void) while (!(fpga_get_reg(k, REG(mc_status)) (1 14))) { udelay(100); - if (ctr++ 3) { + if (ctr++ 500) { timeout = 1; break; } @@ -61,6 +61,8 @@ int mclink_probe(void) if (timeout) break; + printf(waited %d us for mclink %d to come up\n, ctr * 100, k); + slaves++; } -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 08/11] powerpc/ppc4xx: Fixup phy erratum on gdsys iocon hardware
Marvell 88E1518 has an erratum that requires fixing up. This patch checks for presence of this phy and adds code for fixup. Signed-off-by: Dirk Eibach eib...@gdsys.de --- board/gdsys/405ep/iocon.c | 214 + include/configs/iocon.h |3 + 2 files changed, 217 insertions(+) diff --git a/board/gdsys/405ep/iocon.c b/board/gdsys/405ep/iocon.c index ece45d6..45c5b36 100644 --- a/board/gdsys/405ep/iocon.c +++ b/board/gdsys/405ep/iocon.c @@ -38,6 +38,8 @@ #include pca953x.h #include pca9698.h +#include miiphy.h + DECLARE_GLOBAL_DATA_PTR; #define LATCH0_BASE (CONFIG_SYS_LATCH_BASE) @@ -95,8 +97,16 @@ enum { MCFPGA_RESET_N = 1 4, }; +enum { + GPIO_MDC = 1 14, + GPIO_MDIO = 1 15, +}; + unsigned int mclink_fpgacount; +static int setup_88e1518(const char *bus, unsigned char addr); +static int verify_88e1518(const char *bus, unsigned char addr); + void fpga_set_reg(unsigned int fpga, u16 reg, u16 data) { int res; @@ -339,6 +349,7 @@ int last_stage_init(void) int slaves; unsigned int k; unsigned char mclink_controllers[] = { 0x24, 0x25, 0x26 }; + int legacy = get_fpga_state(0) FPGA_STATE_PLATFORM; print_fpga_info(0); osd_probe(0); @@ -360,6 +371,16 @@ int last_stage_init(void) } } + if (!legacy) { + miiphy_register(bb_miiphy_buses[0].name, bb_miiphy_read, + bb_miiphy_write); + if (!verify_88e1518(bb_miiphy_buses[0].name, 0)) { + printf(Fixup 88e1518 erratum on %s\n, + bb_miiphy_buses[0].name); + setup_88e1518(bb_miiphy_buses[0].name, 0); + } + } + /* wait for slave-PLLs to be up and running */ udelay(50); @@ -375,6 +396,13 @@ int last_stage_init(void) for (k = 1; k = slaves; ++k) { print_fpga_info(k); osd_probe(k); + miiphy_register(bb_miiphy_buses[k].name, + bb_miiphy_read, bb_miiphy_write); + if (!verify_88e1518(bb_miiphy_buses[k].name, 0)) { + printf(Fixup 88e1518 erratum on %s\n, + bb_miiphy_buses[k].name); + setup_88e1518(bb_miiphy_buses[k].name, 0); + } } return 0; @@ -446,3 +474,189 @@ int gd405ep_get_fpga_done(unsigned fpga) else return pca9698_get_value(0x20, 20); } + +/* + * FPGA MII bitbang implementation + */ + +struct fpga_mii { + unsigned fpga; + int mdio; +} fpga_mii[] = { + { 0, 1}, + { 1, 1}, + { 2, 1}, + { 3, 1}, +}; + +static int mii_dummy_init(struct bb_miiphy_bus *bus) +{ + return 0; +} + +static int mii_mdio_active(struct bb_miiphy_bus *bus) +{ + struct fpga_mii *fpga_mii = bus-priv; + + if (fpga_mii-mdio) + fpga_set_reg(fpga_mii-fpga, REG(gpio.set), GPIO_MDIO); + else + fpga_set_reg(fpga_mii-fpga, REG(gpio.clear), GPIO_MDIO); + + return 0; +} + +static int mii_mdio_tristate(struct bb_miiphy_bus *bus) +{ + struct fpga_mii *fpga_mii = bus-priv; + + fpga_set_reg(fpga_mii-fpga, REG(gpio.set), GPIO_MDIO); + + return 0; +} + +static int mii_set_mdio(struct bb_miiphy_bus *bus, int v) +{ + struct fpga_mii *fpga_mii = bus-priv; + + if (v) + fpga_set_reg(fpga_mii-fpga, REG(gpio.set), GPIO_MDIO); + else + fpga_set_reg(fpga_mii-fpga, REG(gpio.clear), GPIO_MDIO); + + fpga_mii-mdio = v; + + return 0; +} + +static int mii_get_mdio(struct bb_miiphy_bus *bus, int *v) +{ + struct fpga_mii *fpga_mii = bus-priv; + + *v = ((fpga_get_reg(fpga_mii-fpga, REG(gpio.read)) GPIO_MDIO) != 0); + + return 0; +} + +static int mii_set_mdc(struct bb_miiphy_bus *bus, int v) +{ + struct fpga_mii *fpga_mii = bus-priv; + + if (v) + fpga_set_reg(fpga_mii-fpga, REG(gpio.set), GPIO_MDC); + else + fpga_set_reg(fpga_mii-fpga, REG(gpio.clear), GPIO_MDC); + + return 0; +} + +static int mii_delay(struct bb_miiphy_bus *bus) +{ + udelay(1); + + return 0; +} + +struct bb_miiphy_bus bb_miiphy_buses[] = { + { + .name = trans1, + .init = mii_dummy_init, + .mdio_active = mii_mdio_active, + .mdio_tristate = mii_mdio_tristate, + .set_mdio = mii_set_mdio, + .get_mdio = mii_get_mdio, + .set_mdc = mii_set_mdc, + .delay = mii_delay, + .priv = fpga_mii[0], + }, + { + .name = trans2, + .init = mii_dummy_init, + .mdio_active = mii_mdio_active, + .mdio_tristate = mii_mdio_tristate, + .set_mdio = mii_set_mdio, +
[U-Boot] [PATCH 10/11] powerpc/ppc4xx: Consider gdsys FPGA OSD size
OSD size was constant 32x16 characters. Now the size is set as announced by the FPGA. Signed-off-by: Dirk Eibach eib...@gdsys.de --- board/gdsys/common/osd.c | 35 +++ 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/board/gdsys/common/osd.c b/board/gdsys/common/osd.c index 81c8136..d557a2e 100644 --- a/board/gdsys/common/osd.c +++ b/board/gdsys/common/osd.c @@ -22,6 +22,7 @@ */ #include common.h +#include malloc.h #include bb_i2c.h #include asm/io.h @@ -42,10 +43,6 @@ #define PIXCLK_640_480_60 2518 -#define BASE_WIDTH 32 -#define BASE_HEIGHT 16 -#define BUFSIZE (BASE_WIDTH * BASE_HEIGHT) - enum { CH7301_CM = 0x1c, /* Clock Mode Register */ CH7301_IC = 0x1d, /* Input Clock Register */ @@ -67,6 +64,11 @@ enum { CH7301_DSP = 0x56, /* DVI Sync polarity Register */ }; +unsigned int base_width; +unsigned int base_height; +size_t bufsize; +u16 *buf; + unsigned int max_osd_screen = CONFIG_SYS_OSD_SCREENS - 1; #if defined(CONFIG_SYS_ICS8N3QV01) || defined(CONFIG_SYS_SIL1178) @@ -264,7 +266,7 @@ static int osd_write_videomem(unsigned screen, unsigned offset, unsigned int k; for (k = 0; k charcount; ++k) { - if (offset + k = BUFSIZE) + if (offset + k = bufsize) return -1; fpga_set_reg(screen, REG(videomem) + sizeof(u16) * (offset + k), data[k]); @@ -284,7 +286,6 @@ static int osd_print(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) unsigned len; u8 color; unsigned int k; - u16 buf[BUFSIZE]; char *text; int res; @@ -298,12 +299,12 @@ static int osd_print(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) color = simple_strtoul(argv[3], NULL, 16); text = argv[4]; charcount = strlen(text); - len = (charcount BUFSIZE) ? BUFSIZE : charcount; + len = (charcount bufsize) ? bufsize : charcount; for (k = 0; k len; ++k) buf[k] = (text[k] 8) | color; - res = osd_write_videomem(screen, y * BASE_WIDTH + x, buf, len); + res = osd_write_videomem(screen, y * base_width + x, buf, len); if (res 0) return res; } @@ -315,15 +316,17 @@ int osd_probe(unsigned screen) { u16 version = fpga_get_reg(screen, REG(osd.version)); u16 features = fpga_get_reg(screen, REG(osd.features)); - unsigned width; - unsigned height; u8 value; - width = ((features 0x3f00) 8) + 1; - height = (features 0x001f) + 1; + base_width = ((features 0x3f00) 8) + 1; + base_height = (features 0x001f) + 1; + bufsize = base_width * base_height; + buf = malloc(sizeof(u16) * bufsize); + if (!buf) + return -1; printf(OSD%d: Digital-OSD version %01d.%02d, %d x%d characters\n, - screen, version/100, version%100, width, height); + screen, version/100, version%100, base_width, base_height); #ifdef CONFIG_SYS_CH7301 value = bb_i2c_reg_read(screen, CH7301_I2C_ADDR, CH7301_DID); @@ -386,7 +389,7 @@ int osd_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) unsigned x; unsigned y; unsigned k; - u16 buffer[BASE_WIDTH]; + u16 buffer[base_width]; char *rp; u16 *wp = buffer; unsigned count = (argc 4) ? @@ -411,13 +414,13 @@ int osd_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) rp += 4; wp++; - if (wp - buffer BASE_WIDTH) + if (wp - buffer base_width) break; } for (k = 0; k count; ++k) { unsigned offset = - y * BASE_WIDTH + x + k * (wp - buffer); + y * base_width + x + k * (wp - buffer); osd_write_videomem(screen, offset, buffer, wp - buffer); } -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 11/11] powerpc/ppc4xx: Remove CONFIG_SYS_FLASH_PROTECTION from gdsys boards
CONFIG_SYS_FLASH_PROTECTION was active on most gdsys boards by default, while hardware flash protection was not implemented. Hardware support was added recently and we get into trouble because backward compatibility is broken (u-boot can't unprotect the protected flash after a downgrade). So we decided to disable hardware flash protection for all our boards. Signed-off-by: Dirk Eibach eib...@gdsys.de --- include/configs/dlvision-10g.h |3 +-- include/configs/dlvision.h |3 +-- include/configs/io.h |3 +-- include/configs/iocon.h|3 +-- include/configs/neo.h |3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/include/configs/dlvision-10g.h b/include/configs/dlvision-10g.h index 2cd2027..1f82d7c 100644 --- a/include/configs/dlvision-10g.h +++ b/include/configs/dlvision-10g.h @@ -34,7 +34,7 @@ * Include common defines/options for all AMCC eval boards */ #define CONFIG_HOSTNAMEdlvsion-10g -#define CONFIG_IDENT_STRING dlvision-10g 0.03 +#define CONFIG_IDENT_STRING dlvision-10g 0.04 #include amcc-common.h #define CONFIG_BOARD_EARLY_INIT_F @@ -161,7 +161,6 @@ #define CONFIG_SYS_FLASH_WRITE_TOUT500 /* Timeout for Flash Write/ms */ #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 1/* use buff'd writes */ -#define CONFIG_SYS_FLASH_PROTECTION1 /* use hardware flash protect */ #define CONFIG_SYS_FLASH_EMPTY_INFO/* 'E' for empty sector on flinfo */ #define CONFIG_SYS_FLASH_QUIET_TEST1 /* no warn upon unknown flash */ diff --git a/include/configs/dlvision.h b/include/configs/dlvision.h index c490ff6..6d922f2 100644 --- a/include/configs/dlvision.h +++ b/include/configs/dlvision.h @@ -34,7 +34,7 @@ * Include common defines/options for all AMCC eval boards */ #define CONFIG_HOSTNAMEdlvision -#define CONFIG_IDENT_STRING dlvision 0.01 +#define CONFIG_IDENT_STRING dlvision 0.02 #include amcc-common.h #define CONFIG_BOARD_EARLY_INIT_F /* call board_early_init_f */ @@ -125,7 +125,6 @@ #define CONFIG_SYS_FLASH_WRITE_TOUT500 /* Timeout for Flash Write/ms */ #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 1/* use buff'd writes */ -#define CONFIG_SYS_FLASH_PROTECTION1 /* use hardware flash protect */ #define CONFIG_SYS_FLASH_EMPTY_INFO/* 'E' for empty sector on flinfo */ #define CONFIG_SYS_FLASH_QUIET_TEST1 /* no warn upon unknown flash */ diff --git a/include/configs/io.h b/include/configs/io.h index 03661cc..b4558e4 100644 --- a/include/configs/io.h +++ b/include/configs/io.h @@ -34,7 +34,7 @@ * Include common defines/options for all AMCC eval boards */ #define CONFIG_HOSTNAMEio -#define CONFIG_IDENT_STRING io 0.05 +#define CONFIG_IDENT_STRING io 0.06 #include amcc-common.h #define CONFIG_BOARD_EARLY_INIT_F @@ -139,7 +139,6 @@ #define CONFIG_SYS_FLASH_WRITE_TOUT500 /* Timeout for Flash Write/ms */ #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 1/* use buff'd writes */ -#define CONFIG_SYS_FLASH_PROTECTION1 /* use hardware flash protect */ #define CONFIG_SYS_FLASH_EMPTY_INFO/* 'E' for empty sector on flinfo */ #define CONFIG_SYS_FLASH_QUIET_TEST1 /* no warn upon unknown flash */ diff --git a/include/configs/iocon.h b/include/configs/iocon.h index 441b37b..f10e929 100644 --- a/include/configs/iocon.h +++ b/include/configs/iocon.h @@ -34,7 +34,7 @@ * Include common defines/options for all AMCC eval boards */ #define CONFIG_HOSTNAMEiocon -#define CONFIG_IDENT_STRING iocon 0.04 +#define CONFIG_IDENT_STRING iocon 0.05 #include amcc-common.h #define CONFIG_BOARD_EARLY_INIT_F @@ -160,7 +160,6 @@ int fpga_gpio_get(unsigned int bus, int pin); #define CONFIG_SYS_FLASH_WRITE_TOUT500 /* Timeout for Flash Write/ms */ #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 1/* use buff'd writes */ -#define CONFIG_SYS_FLASH_PROTECTION1 /* use hardware flash protect */ #define CONFIG_SYS_FLASH_EMPTY_INFO/* 'E' for empty sector on flinfo */ #define CONFIG_SYS_FLASH_QUIET_TEST1 /* no warn upon unknown flash */ diff --git a/include/configs/neo.h b/include/configs/neo.h index 38b5bec..59d7820 100644 --- a/include/configs/neo.h +++ b/include/configs/neo.h @@ -35,7 +35,7 @@ * Include common defines/options for all AMCC eval boards */ #define CONFIG_HOSTNAMEneo -#define CONFIG_IDENT_STRING neo 0.01 +#define CONFIG_IDENT_STRING neo 0.02 #include amcc-common.h #define CONFIG_BOARD_EARLY_INIT_F @@ -146,7 +146,6 @@ #define CONFIG_SYS_FLASH_WRITE_TOUT500 /* Timeout for Flash Write (in ms) */ #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 1/* use buffered writes (20x faster) */ -#define CONFIG_SYS_FLASH_PROTECTION1 /* use hardware flash protection*/ #define CONFIG_SYS_FLASH_EMPTY_INFO/* print 'E' for empty sector on
[U-Boot] [PATCH 07/11] powerpc/ppc4xx: Use generic FPGA accessors on all gdsys 405ep/ex boards
Signed-off-by: Dirk Eibach eib...@gdsys.de --- board/gdsys/405ep/dlvision-10g.c | 20 ++-- board/gdsys/405ep/io.c | 20 ++-- board/gdsys/405ep/neo.c | 17 + board/gdsys/405ex/405ex.c| 14 ++ board/gdsys/405ex/io64.c | 38 ++ 5 files changed, 69 insertions(+), 40 deletions(-) diff --git a/board/gdsys/405ep/dlvision-10g.c b/board/gdsys/405ep/dlvision-10g.c index 644493b..4d1a02e 100644 --- a/board/gdsys/405ep/dlvision-10g.c +++ b/board/gdsys/405ep/dlvision-10g.c @@ -71,6 +71,16 @@ enum { RAM_DDR2_64 = 2, }; +void fpga_set_reg(unsigned int fpga, u16 reg, u16 data) +{ + out_le16((u16 *)CONFIG_SYS_FPGA_BASE(fpga) + reg / sizeof(u16), data); +} + +u16 fpga_get_reg(unsigned int fpga, u16 reg) +{ + return in_le16((u16 *)CONFIG_SYS_FPGA_BASE(fpga) + reg / sizeof(u16)); +} + int misc_init_r(void) { /* startup fans */ @@ -95,10 +105,9 @@ static unsigned int get_mc2_present(void) static void print_fpga_info(unsigned dev) { - struct ihs_fpga *fpga = (struct ihs_fpga *) CONFIG_SYS_FPGA_BASE(dev); - u16 versions = in_le16(fpga-versions); - u16 fpga_version = in_le16(fpga-fpga_version); - u16 fpga_features = in_le16(fpga-fpga_features); + u16 versions = fpga_get_reg(dev, REG(versions)); + u16 fpga_version = fpga_get_reg(dev, REG(fpga_version)); + u16 fpga_features = fpga_get_reg(dev, REG(fpga_features)); unsigned unit_type; unsigned hardware_version; unsigned feature_rs232; @@ -263,8 +272,7 @@ int checkboard(void) int last_stage_init(void) { - struct ihs_fpga *fpga = (struct ihs_fpga *) CONFIG_SYS_FPGA_BASE(0); - u16 versions = in_le16(fpga-versions); + u16 versions = fpga_get_reg(0, REG(versions)); print_fpga_info(0); if (get_mc2_present()) diff --git a/board/gdsys/405ep/io.c b/board/gdsys/405ep/io.c index 070dcbb..dbaf9d6 100644 --- a/board/gdsys/405ep/io.c +++ b/board/gdsys/405ep/io.c @@ -53,6 +53,16 @@ enum { HWVER_122 = 3, }; +void fpga_set_reg(unsigned int fpga, u16 reg, u16 data) +{ + out_le16((u16 *)CONFIG_SYS_FPGA_BASE(fpga) + reg / sizeof(u16), data); +} + +u16 fpga_get_reg(unsigned int fpga, u16 reg) +{ + return in_le16((u16 *)CONFIG_SYS_FPGA_BASE(fpga) + reg / sizeof(u16)); +} + int misc_init_r(void) { /* startup fans */ @@ -117,10 +127,9 @@ int checkboard(void) static void print_fpga_info(void) { - struct ihs_fpga *fpga = (struct ihs_fpga *) CONFIG_SYS_FPGA_BASE(0); - u16 versions = in_le16(fpga-versions); - u16 fpga_version = in_le16(fpga-fpga_version); - u16 fpga_features = in_le16(fpga-fpga_features); + u16 versions = fpga_get_reg(0, REG(versions)); + u16 fpga_version = fpga_get_reg(0, REG(fpga_version)); + u16 fpga_features = fpga_get_reg(0, REG(fpga_features)); unsigned unit_type; unsigned hardware_version; unsigned feature_channels; @@ -179,7 +188,6 @@ static void print_fpga_info(void) */ int last_stage_init(void) { - struct ihs_fpga *fpga = (struct ihs_fpga *) CONFIG_SYS_FPGA_BASE(0); unsigned int k; print_fpga_info(); @@ -191,7 +199,7 @@ int last_stage_init(void) configure_gbit_phy(k); /* take fpga serdes blocks out of reset */ - out_le16(fpga-quad_serdes_reset, 0); + fpga_set_reg(0, REG(quad_serdes_reset), 0); return 0; } diff --git a/board/gdsys/405ep/neo.c b/board/gdsys/405ep/neo.c index d336e55..f06a280 100644 --- a/board/gdsys/405ep/neo.c +++ b/board/gdsys/405ep/neo.c @@ -44,6 +44,16 @@ enum { HWVER_300 = 3, }; +void fpga_set_reg(unsigned int fpga, u16 reg, u16 data) +{ + out_le16((u16 *)CONFIG_SYS_FPGA_BASE(fpga) + reg / sizeof(u16), data); +} + +u16 fpga_get_reg(unsigned int fpga, u16 reg) +{ + return in_le16((u16 *)CONFIG_SYS_FPGA_BASE(fpga) + reg / sizeof(u16)); +} + int misc_init_r(void) { /* startup fans */ @@ -70,10 +80,9 @@ int checkboard(void) static void print_fpga_info(void) { - struct ihs_fpga *fpga = (struct ihs_fpga *) CONFIG_SYS_FPGA_BASE(0); - u16 versions = in_le16(fpga-versions); - u16 fpga_version = in_le16(fpga-fpga_version); - u16 fpga_features = in_le16(fpga-fpga_features); + u16 versions = fpga_get_reg(0, REG(versions)); + u16 fpga_version = fpga_get_reg(0, REG(fpga_version)); + u16 fpga_features = fpga_get_reg(0, REG(fpga_features)); int fpga_state = get_fpga_state(0); unsigned unit_type; unsigned hardware_version; diff --git a/board/gdsys/405ex/405ex.c b/board/gdsys/405ex/405ex.c index 32e24c0..b7e9802 100644 --- a/board/gdsys/405ex/405ex.c +++ b/board/gdsys/405ex/405ex.c @@ -220,23 +220,21 @@ int board_early_init_r(void) gd405ex_set_fpga_reset(0); for (k = 0; k CONFIG_SYS_FPGA_COUNT; ++k) { -
Re: [U-Boot] [PATCH 6/6] arm: mx5: Add support for DENX M53EVK
Dear Marek, In message 201304220109.14740.ma...@denx.de you wrote: Looking through the code, it seems CONFIG_SYS_LOAD_ADDR is preferred over CONFIG_LOADADDR, so this should be fixed on all places then ? Just to be clear on this. CONFIG_SYS_LOAD_ADDR is _used_, but not preferred ;-) Yes, I think we should eliminate CONFIG_SYS_LOAD_ADDR and globally replace it by CONFIG_LOADADDR. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de There is is no reason for any individual to have a computer in their home. -- Ken Olsen (President of Digital Equipment Corporation), Convention of the World Future Society, in Boston, 1977 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Add NanoBone board support
On 22/04/13 11:04, Mark Jackson wrote: On 16/04/13 20:22, Tom Rini wrote: On Tue, Apr 16, 2013 at 08:14:13PM +0100, Mark Jackson wrote: On 16/04/13 16:48, Tom Rini wrote: On Tue, Apr 16, 2013 at 04:02:34PM +0100, Mark Jackson wrote: snip +static struct cpsw_platform_data cpsw_data = { + .mdio_base = CPSW_MDIO_BASE, + .cpsw_base = CPSW_BASE, + .mdio_div = 0xff, + .channels = 8, + .cpdma_reg_ofs = 0x800, + .slaves = 2, Is this all that was needed for both interfaces to work in U-Boot, along with a config change or two? If so, I should take a stab at getting both working on the EVM-SK. Yes ... the config change is just to set CONFIG_PHY_ADDR to the correct value. Unfortunately, since the CONFIG_PHY_ADDR value is hard-coded into quite a bit of the uboot code, to change ports, you need to re-compile !! Not ideal, and I don't suppose it's too much work to get both working together, but I don't see much demand for it. Ah, so it's not quite right :( Other platforms support multiple interfaces, but I don't know how they're setup. Tom I can see in drivers/net/cpsw.c:- static int cpsw_phy_init(struct eth_device *dev, struct cpsw_slave *slave) { ... phydev = phy_connect(priv-bus, CONFIG_PHY_ADDR, dev, slave-data-phy_if); ... } As you can see the hardcoded CONFIG_PHY_ADDR is being used, despite the fact that it might be different for each slave. Could you just replace that with slave-data-phy_id ? I'll give it a try and see what happens. No, that doesn't fix things. It looks like the PHY device is stored in the cpsw struct (rather than in the slave struct) ... from cpsw.c:- struct cpsw_priv { struct eth_device *dev; struct cpsw_platform_data data; int host_port; struct cpsw_regs*regs; void*dma_regs; struct cpsw_host_regs *host_port_regs; void*ale_regs; struct cpdma_desc *descs; struct cpdma_desc *desc_free; struct cpdma_chan rx_chan, tx_chan; struct cpsw_slave *slaves; struct phy_device *phydev; struct mii_dev *bus; u32 mdio_link; u32 phy_mask; }; So there's an assumption that you can only have a single PHY (even though you can have 2 slaves). I've gone as far as I dare with my limited knowledge. Regards Mark J. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2] Add NanoBone board support
NanoBone Specification: --- CPU: TI AM335x Memory: 256MB DDR3 64MB NOR flash 256MB NAND flash 128KB FRAM Ethernet: 2 x 10/100 connected to SMSC LAN8710 PHY USB: 1 x USB2.0 Type A I2C: 2Kbit EEPROM (Microchip 24AA02) RTC (Maxim DS1338) GPIO Expander (Microchip MCP23017) Expansion connector: 6 x UART 1 x MMC/SD 1 x USB2.0 Signed-off-by: Mark Jackson m...@newflow.co.uk --- Changes in v2: - Tweaked after comments from Tom Rini MAINTAINERS |4 + board/newflow/nanobone/Makefile | 46 ++ board/newflow/nanobone/board.c | 304 +++ board/newflow/nanobone/board.h | 24 board/newflow/nanobone/mux.c| 203 ++ boards.cfg |1 + include/configs/nanobone.h | 285 7 files changed, 867 insertions(+) create mode 100644 board/newflow/nanobone/Makefile create mode 100644 board/newflow/nanobone/board.c create mode 100644 board/newflow/nanobone/board.h create mode 100644 board/newflow/nanobone/mux.c create mode 100644 include/configs/nanobone.h diff --git a/MAINTAINERS b/MAINTAINERS index bbab5fe..3724e21 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -711,6 +711,10 @@ Ilko Iliev il...@ronetix.at PM9263 AT91SAM9263 PM9G45 ARM926EJS (AT91SAM9G45 SoC) +Mark Jackson m...@newflow.co.uk + + NANOBONEARM ARMV7 (AM33xx Soc) + Michael Jones michael.jo...@matrix-vision.de omap3_mvblx ARM ARMV7 (OMAP3xx SoC) diff --git a/board/newflow/nanobone/Makefile b/board/newflow/nanobone/Makefile new file mode 100644 index 000..67a87a1 --- /dev/null +++ b/board/newflow/nanobone/Makefile @@ -0,0 +1,46 @@ +# +# Makefile +# +# Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed as is WITHOUT ANY WARRANTY of any +# kind, whether express or implied; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + +include $(TOPDIR)/config.mk + +LIB= $(obj)lib$(BOARD).o + +ifdef CONFIG_SPL_BUILD +COBJS := mux.o +endif + +COBJS += board.o +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB):$(obj).depend $(OBJS) $(SOBJS) + $(call cmd_link_o_target, $(OBJS) $(SOBJS)) + +clean: + rm -f $(SOBJS) $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak $(obj).depend + +# + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +# diff --git a/board/newflow/nanobone/board.c b/board/newflow/nanobone/board.c new file mode 100644 index 000..d0af256 --- /dev/null +++ b/board/newflow/nanobone/board.c @@ -0,0 +1,304 @@ +/* + * board.c + * + * Board functions for Newflow NanoBone board + * + * Copyright (C) 2013, Newflow Ltd - http://www.newflow.co.uk/ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the + * GNU General Public License for more details. + */ + +#include common.h +#include errno.h +#include asm/arch/clock.h +#include asm/arch/cpu.h +#include asm/arch/ddr_defs.h +#include asm/arch/gpio.h +#include asm/arch/hardware.h +#include asm/arch/sys_proto.h +#include asm/arch/mem.h +#include asm/arch/mmc_host_def.h +#include asm/arch/omap.h +#include asm/emif.h +#include asm/gpio.h +#include asm/io.h +#include cpsw.h +#include i2c.h +#include miiphy.h +#include spl.h +#include board.h + +DECLARE_GLOBAL_DATA_PTR; + +/* FRAM config */ +#define FRAM_CS1 +#define FRAM_BASE 0x1c00 +#define FRAM_SIZE GPMC_SIZE_16M +static u32 gpmc_fram_config[GPMC_MAX_REG] = { + 0x1200, + 0x00101000, + 0x00020201, + 0x0f030f03, + 0x010d1010, + 0x000301c0, + 0 +}; + +/* NOR Flash config */ +#define NOR_CS 3 +#define NOR_BASE 0x1800 +#define NOR_SIZE GPMC_SIZE_64M +static u32 gpmc_nor_config[GPMC_MAX_REG] = { + 0x1200, + 0x00101004, + 0x00020201, + 0x10041004, + 0x010f1010, +
[U-Boot] [PATCH v3 0/19] Allow images to work on sandbox
This series adjusts the image code to work with sandbox and prepares it for verified boot to come later. The primary goal here is to get image loading to work on sandbox, which is mostly a set of fairly minor changes such as using map_sysmem() instead of just a cast when converting from a U-Boot address to a pointer. Since common/image.c runs to over 3000 lines and half of it is FIT-related code behind an #ifdef, this code is moved into a new image-fit.c file. This series depends on the sandbox generic board series: sandbox: Generic board support and other improvements Changes in v3: - Update notes to note that generic board support has now landed - Split out image improvements into a separate series Changes in v2: - Change hash_block() to use an unsigned int len - Clarify use of output_size parameter to hash_block() - Fix line continuation problem - Fix checkpatch checks about parenthesis alignment - Rebase on previous patches - Rebase on previous patches - Rebase on previous patches - Add IMAGE_ENABLE_IGNORE to avoid #ifdef around ignore property handling - Rename commit message to say function instead of function - Rebase on previous patches - Put err_msgp strings on a single line - Rebase on previous patches - Put params before description in fit_conf_get_prop_node() comment - Rebase on previous patches - Rebase on previous patches - Fix checkpatch checks about parenthesis alignment Simon Glass (19): env: Fix minor comment typos in cmd_nvedit Add minor updates to README.fdt-control hash: Add a way to calculate a hash for any algortihm bootstage: Don't build for HOSTCC mkimage: Move ARRAY_SIZE to header file libfdt: Add fdt_next_subnode() to permit easy subnode iteration image: Move timestamp #ifdefs to header file image: Export fit_check_ramdisk() image: Split FIT code into new image-fit.c image: Move HOSTCC image code to tools/ image: Split hash node processing into its own function image: Convert fit_image_hash_set_value() to static, and rename image: Rename fit_image_check_hashes() to fit_image_verify() image: Move hash checking into its own function image: Move error! string to common place image: Export fit_conf_get_prop_node() image: Rename fit_add_hashes() to fit_add_verification_data() image: Rename hash printing to fit_image_print_verification_data() sandbox: image: Add support for booting images in sandbox common/Makefile|1 + common/cmd_bootm.c | 25 +- common/cmd_fpga.c |2 +- common/cmd_nvedit.c|4 +- common/cmd_source.c|2 +- common/cmd_ximg.c |2 +- common/hash.c | 23 + common/image-fit.c | 1497 ++ common/image.c | 1679 ++-- common/update.c|2 +- doc/README.fdt-control |9 +- include/bootstage.h|5 +- include/hash.h | 22 + include/image.h| 55 +- include/libfdt.h | 17 + lib/libfdt/fdt.c | 12 + tools/Makefile |4 + tools/aisimage.c |1 - tools/fit_image.c |2 +- tools/image-host.c | 213 ++ tools/mkimage.h|2 + 21 files changed, 1903 insertions(+), 1676 deletions(-) create mode 100644 common/image-fit.c create mode 100644 tools/image-host.c -- 1.8.2.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 02/19] Add minor updates to README.fdt-control
A few things have changed since this doc was written, so update it to match the current state of things. Signed-off-by: Simon Glass s...@chromium.org --- Changes in v3: - Update notes to note that generic board support has now landed Changes in v2: None doc/README.fdt-control | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/README.fdt-control b/doc/README.fdt-control index 5963f78..95a88a7 100644 --- a/doc/README.fdt-control +++ b/doc/README.fdt-control @@ -49,6 +49,12 @@ the features of each board in the device tree file, and have a single generic source base. To enable this feature, add CONFIG_OF_CONTROL to your board config file. +It is currently supported on ARM, x86 and Microblaze - other architectures +will need to add code to their arch/xxx/lib/board.c file to locate the +FDT. Alternatively you can enable generic board support on your board +(with CONFIG_SYS_GENERIC_BOARD) if this is available (as it is for +PowerPC). For ARM, Tegra and Exynos5 have device trees available for +common devices. What is a Flat Device Tree? @@ -99,7 +105,8 @@ Then run the compiler (your version will vary): * Bad configuration: 0 * Strange test result: 0 -You will also find a useful ftdump utility for decoding a binary file. +You will also find a useful fdtdump utility for decoding a binary file, as +well as fdtget/fdtput for reading and writing properties in a binary file. Where do I get an fdt file for my board? -- 1.8.2.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 01/19] env: Fix minor comment typos in cmd_nvedit
This should say 'environmnent'. Signed-off-by: Simon Glass s...@chromium.org --- Changes in v3: None Changes in v2: None common/cmd_nvedit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index d893aa1..9579f94 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -288,7 +288,7 @@ int setenv(const char *varname, const char *varvalue) /** * Set an environment variable to an integer value * - * @param varname Environmet variable to set + * @param varname Environment variable to set * @param valueValue to set it to * @return 0 if ok, 1 on error */ @@ -303,7 +303,7 @@ int setenv_ulong(const char *varname, ulong value) /** * Set an environment variable to an value in hex * - * @param varname Environmet variable to set + * @param varname Environment variable to set * @param valueValue to set it to * @return 0 if ok, 1 on error */ -- 1.8.2.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 11/19] image: Split hash node processing into its own function
This function has become quite long and much of the body is indented quite a bit. Move it into a separate function to make it easier to work with. Signed-off-by: Simon Glass s...@chromium.org Acked-by: Marek Vasut ma...@denx.de --- Changes in v3: None Changes in v2: - Rebase on previous patches tools/image-host.c | 96 -- 1 file changed, 57 insertions(+), 39 deletions(-) diff --git a/tools/image-host.c b/tools/image-host.c index 82b6cee..6648215 100644 --- a/tools/image-host.c +++ b/tools/image-host.c @@ -79,6 +79,56 @@ int fit_set_hashes(void *fit) } /** + * fit_image_process_hash - Process a single subnode of the images/ node + * + * Check each subnode and process accordingly. For hash nodes we generate + * a hash of the supplised data and store it in the node. + * + * @fit: pointer to the FIT format image header + * @image_name:name of image being processes (used to display errors) + * @noffset: subnode offset + * @data: data to process + * @size: size of data in bytes + * @return 0 if ok, -1 on error + */ +static int fit_image_process_hash(void *fit, const char *image_name, + int noffset, const void *data, size_t size) +{ + uint8_t value[FIT_MAX_HASH_LEN]; + int value_len; + char *algo; + + /* +* Check subnode name, must be equal to hash. +* Multiple hash nodes require unique unit node +* names, e.g. hash@1, hash@2, etc. +*/ + if (strncmp(fit_get_name(fit, noffset, NULL), + FIT_HASH_NODENAME, strlen(FIT_HASH_NODENAME)) != 0) + return 0; + + if (fit_image_hash_get_algo(fit, noffset, algo)) { + printf(Can't get hash algo property for '%s' hash node in '%s' image node\n, + fit_get_name(fit, noffset, NULL), image_name); + return -1; + } + + if (calculate_hash(data, size, algo, value, value_len)) { + printf(Unsupported hash algorithm (%s) for '%s' hash node in '%s' image node\n, + algo, fit_get_name(fit, noffset, NULL), image_name); + return -1; + } + + if (fit_image_hash_set_value(fit, noffset, value, value_len)) { + printf(Can't set hash value for '%s' hash node in '%s' image node\n, + fit_get_name(fit, noffset, NULL), image_name); + return -1; + } + + return 0; +} + +/** * fit_image_set_hashes - calculate/set hashes for given component image node * @fit: pointer to the FIT format image header * @image_noffset: requested component image node @@ -111,11 +161,9 @@ int fit_image_set_hashes(void *fit, int image_noffset) { const void *data; size_t size; - char *algo; - uint8_t value[FIT_MAX_HASH_LEN]; - int value_len; int noffset; int ndepth; + const char *image_name; /* Get image data and data length */ if (fit_image_get_data(fit, image_noffset, data, size)) { @@ -123,47 +171,17 @@ int fit_image_set_hashes(void *fit, int image_noffset) return -1; } + image_name = fit_get_name(fit, image_noffset, NULL); + /* Process all hash subnodes of the component image node */ for (ndepth = 0, noffset = fdt_next_node(fit, image_noffset, ndepth); -(noffset = 0) (ndepth 0); -noffset = fdt_next_node(fit, noffset, ndepth)) { + (noffset = 0) (ndepth 0); + noffset = fdt_next_node(fit, noffset, ndepth)) { if (ndepth == 1) { /* Direct child node of the component image node */ - - /* -* Check subnode name, must be equal to hash. -* Multiple hash nodes require unique unit node -* names, e.g. hash@1, hash@2, etc. -*/ - if (strncmp(fit_get_name(fit, noffset, NULL), - FIT_HASH_NODENAME, - strlen(FIT_HASH_NODENAME)) != 0) { - /* Not a hash subnode, skip it */ - continue; - } - - if (fit_image_hash_get_algo(fit, noffset, algo)) { - printf(Can't get hash algo property for '%s' hash node in '%s' image node\n, - fit_get_name(fit, noffset, NULL), - fit_get_name(fit, image_noffset, NULL)); - return -1; - } - - if (calculate_hash(data, size, algo, value, - value_len)) { - printf(Unsupported hash algorithm (%s) for '%s' hash node in '%s' image node\n, -
[U-Boot] [PATCH v3 06/19] libfdt: Add fdt_next_subnode() to permit easy subnode iteration
This allows use to replace code like this: for (ndepth = 0, count = 0, noffset = fdt_next_node(fit, images_noffset, ndepth); (noffset = 0) (ndepth 0); noffset = fdt_next_node(fit, noffset, ndepth)) { if (ndepth == 1) ... with: for (ndepth = 0, noffset = fdt_next_subnode(fit, image_noffset, ndepth); noffset = 0; noffset = fdt_next_subnode(fit, noffset, ndepth)) { which is slightly better, and doesn't require two levels of indentation for code in the loop. Signed-off-by: Simon Glass s...@chromium.org --- Changes in v3: None Changes in v2: None include/libfdt.h | 17 + lib/libfdt/fdt.c | 12 2 files changed, 29 insertions(+) diff --git a/include/libfdt.h b/include/libfdt.h index fc7f75b..50c90d6 100644 --- a/include/libfdt.h +++ b/include/libfdt.h @@ -136,6 +136,23 @@ uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset); int fdt_next_node(const void *fdt, int offset, int *depth); +/** + * fdt_next_subnode() - get offset of next direct child + * + * Set depth to 0, offset to parent, then call this function repeatedly + * to get direct subnodes of a parent node. + * + * @fdt: FDT blob + * @offset:Set this to offset of parent for the first call. For + * subsquent calls, pass in the value returns from the last + * call. + * @depth: Used internally to monitor depth - set this to 0 for the + * first call. + * @return offset of next subnode, or -FDT_ERR_NOTFOUND if there are no more + * children + */ +int fdt_next_subnode(const void *fdt, int offset, int *depth); + /**/ /* General functions */ /**/ diff --git a/lib/libfdt/fdt.c b/lib/libfdt/fdt.c index 387e354..cd86811 100644 --- a/lib/libfdt/fdt.c +++ b/lib/libfdt/fdt.c @@ -202,6 +202,18 @@ int fdt_next_node(const void *fdt, int offset, int *depth) return offset; } +int fdt_next_subnode(const void *fdt, int offset, int *depth) +{ + /* Loop until we find a direct child of the parent (depth == 1) */ + do { + offset = fdt_next_node(fdt, offset, depth); + if (offset 0 || *depth 1) + return -FDT_ERR_NOTFOUND; + } while (*depth 1); + + return offset; +} + const char *_fdt_find_string(const char *strtab, int tabsize, const char *s) { int len = strlen(s) + 1; -- 1.8.2.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 03/19] hash: Add a way to calculate a hash for any algortihm
Rather than needing to call one of many hashing algorithms in U-Boot, provide a function hash_block() which handles this, and can support all available hash algorithms. Once we have md5 supported within hashing, we can use this function in the FIT image code. Signed-off-by: Simon Glass s...@chromium.org --- Changes in v3: None Changes in v2: - Change hash_block() to use an unsigned int len - Clarify use of output_size parameter to hash_block() common/hash.c | 23 +++ include/hash.h | 22 ++ 2 files changed, 45 insertions(+) diff --git a/common/hash.c b/common/hash.c index c9ac33e..fe19b73 100644 --- a/common/hash.c +++ b/common/hash.c @@ -30,6 +30,7 @@ #include sha1.h #include sha256.h #include asm/io.h +#include asm/errno.h /* * These are the hash algorithms we support. Chips which support accelerated @@ -238,6 +239,28 @@ static void show_hash(struct hash_algo *algo, ulong addr, ulong len, printf(%02x, output[i]); } +int hash_block(const char *algo_name, const void *data, unsigned int len, + uint8_t *output, int *output_size) +{ + struct hash_algo *algo; + + algo = find_hash_algo(algo_name); + if (!algo) { + debug(Unknown hash algorithm '%s'\n, algo_name); + return -EPROTONOSUPPORT; + } + if (output_size *output_size algo-digest_size) { + debug(Output buffer size %d too small (need %d bytes), + *output_size, algo-digest_size); + return -ENOSPC; + } + if (output_size) + *output_size = algo-digest_size; + algo-hash_func_ws(data, len, output, algo-chunk_size); + + return 0; +} + int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { diff --git a/include/hash.h b/include/hash.h index 2dbbd9b..c402067 100644 --- a/include/hash.h +++ b/include/hash.h @@ -71,4 +71,26 @@ enum { int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); +/** + * hash_block() - Hash a block according to the requested algorithm + * + * The caller probably knows the hash length for the chosen algorithm, but + * in order to provide a general interface, and output_size parameter is + * provided. + * + * @algo_name: Hash algorithm to use + * @data: Data to hash + * @len: Lengh of data to hash in bytes + * @output:Place to put hash value + * @output_size: On entry, pointer to the number of bytes available in + * output. On exit, pointer to the number of bytes used. + * If NULL, then it is assumed that the caller has + * allocated enough space for the hash. This is possible + * since the caller is selecting the algorithm. + * @return 0 if ok, -ve on error: -EPROTONOSUPPORT for an unknown algorithm, + * -ENOSPC if the output buffer is not large enough. + */ +int hash_block(const char *algo_name, const void *data, unsigned int len, + uint8_t *output, int *output_size); + #endif -- 1.8.2.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 04/19] bootstage: Don't build for HOSTCC
We don't measure boot timing on the host, or with SPL, so use both conditions in the bootstage header. This allows us to avoid using conditional compilation around bootstage_...() calls. (#ifdef) Signed-off-by: Simon Glass s...@chromium.org --- Changes in v3: None Changes in v2: - Fix line continuation problem include/bootstage.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/bootstage.h b/include/bootstage.h index 3b2216b..4df03ae 100644 --- a/include/bootstage.h +++ b/include/bootstage.h @@ -221,7 +221,7 @@ enum bootstage_id { */ ulong timer_get_boot_us(void); -#ifndef CONFIG_SPL_BUILD +#if !defined(CONFIG_SPL_BUILD) !defined(USE_HOSTCC) /* * Board code can implement show_boot_progress() if needed. * @@ -233,7 +233,8 @@ void show_boot_progress(int val); #define show_boot_progress(val) do {} while (0) #endif -#if defined(CONFIG_BOOTSTAGE) !defined(CONFIG_SPL_BUILD) +#if defined(CONFIG_BOOTSTAGE) !defined(CONFIG_SPL_BUILD) \ + !defined(USE_HOSTCC) /* This is the full bootstage implementation */ /** -- 1.8.2.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 15/19] image: Move error! string to common place
The string error\n appears in each error string. Move it out to a common place. Signed-off-by: Simon Glass s...@chromium.org Reviewed-by: Marek Vasut ma...@denx.de --- Changes in v3: None Changes in v2: - Put err_msgp strings on a single line - Rebase on previous patches common/image-fit.c | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/common/image-fit.c b/common/image-fit.c index fa21f18..97f8521 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -860,8 +860,7 @@ static int fit_image_check_hash(const void *fit, int noffset, const void *data, *err_msgp = NULL; if (fit_image_hash_get_algo(fit, noffset, algo)) { - *err_msgp = error!\nCan't get hash algo - property; + *err_msgp = Can't get hash algo property; return -1; } printf(%s, algo); @@ -876,22 +875,20 @@ static int fit_image_check_hash(const void *fit, int noffset, const void *data, if (fit_image_hash_get_value(fit, noffset, fit_value, fit_value_len)) { - *err_msgp = error!\nCan't get hash value - property; + *err_msgp = Can't get hash value property; return -1; } if (calculate_hash(data, size, algo, value, value_len)) { - *err_msgp = error!\n - Unsupported hash algorithm; + *err_msgp = Unsupported hash algorithm; return -1; } if (value_len != fit_value_len) { - *err_msgp = error !\nBad hash value len; + *err_msgp = Bad hash value len; return -1; } else if (memcmp(value, fit_value, value_len) != 0) { - *err_msgp = error!\nBad hash value; + *err_msgp = Bad hash value; return -1; } @@ -921,7 +918,7 @@ int fit_image_verify(const void *fit, int image_noffset) /* Get image data and data length */ if (fit_image_get_data(fit, image_noffset, data, size)) { - printf(Can't get image data/size\n); + err_msg = Can't get image data/size; return 0; } @@ -947,14 +944,14 @@ int fit_image_verify(const void *fit, int image_noffset) } if (noffset == -FDT_ERR_TRUNCATED || noffset == -FDT_ERR_BADSTRUCTURE) { - err_msg = error!\nCorrupted or truncated tree; + err_msg = Corrupted or truncated tree; goto error; } return 1; error: - printf(%s for '%s' hash node in '%s' image node\n, + printf( error!\n%s for '%s' hash node in '%s' image node\n, err_msg, fit_get_name(fit, noffset, NULL), fit_get_name(fit, image_noffset, NULL)); return 0; -- 1.8.2.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 17/19] image: Rename fit_add_hashes() to fit_add_verification_data()
We intend to add signatures to FITs also, so rename this function so that it is not specific to hashing. Also rename fit_image_set_hashes() and make it static since it is not used outside this file. Signed-off-by: Simon Glass s...@chromium.org Reviewed-by: Marek Vasut ma...@denx.de --- Changes in v3: None Changes in v2: - Rebase on previous patches include/image.h| 10 +++- tools/fit_image.c | 2 +- tools/image-host.c | 146 + 3 files changed, 79 insertions(+), 79 deletions(-) diff --git a/include/image.h b/include/image.h index 6d7cd54..f82d709 100644 --- a/include/image.h +++ b/include/image.h @@ -614,8 +614,14 @@ int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value, int *value_len); int fit_set_timestamp(void *fit, int noffset, time_t timestamp); -int fit_set_hashes(void *fit); -int fit_image_set_hashes(void *fit, int image_noffset); + +/** + * fit_add_verification_data() - Calculate and add hashes to FIT + * + * @fit: Fit image to process + * @return 0 if ok, 0 for error + */ +int fit_add_verification_data(void *fit); int fit_image_verify(const void *fit, int noffset); int fit_all_image_verify(const void *fit); diff --git a/tools/fit_image.c b/tools/fit_image.c index 76bbba1..8f51159 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -125,7 +125,7 @@ static int fit_handle_file (struct mkimage_params *params) } /* set hashes for images in the blob */ - if (fit_set_hashes (ptr)) { + if (fit_add_verification_data(ptr)) { fprintf (stderr, %s Can't add hashes to FIT blob, params-cmdname); unlink (tmpfile); diff --git a/tools/image-host.c b/tools/image-host.c index a6b4f6b..3ba05de 100644 --- a/tools/image-host.c +++ b/tools/image-host.c @@ -34,51 +34,6 @@ #include u-boot/md5.h /** - * fit_set_hashes - process FIT component image nodes and calculate hashes - * @fit: pointer to the FIT format image header - * - * fit_set_hashes() adds hash values for all component images in the FIT blob. - * Hashes are calculated for all component images which have hash subnodes - * with algorithm property set to one of the supported hash algorithms. - * - * returns - * 0, on success - * libfdt error code, on failure - */ -int fit_set_hashes(void *fit) -{ - int images_noffset; - int noffset; - int ndepth; - int ret; - - /* Find images parent node offset */ - images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH); - if (images_noffset 0) { - printf(Can't find images parent node '%s' (%s)\n, - FIT_IMAGES_PATH, fdt_strerror(images_noffset)); - return images_noffset; - } - - /* Process its subnodes, print out component images details */ - for (ndepth = 0, noffset = fdt_next_node(fit, images_noffset, ndepth); -(noffset = 0) (ndepth 0); -noffset = fdt_next_node(fit, noffset, ndepth)) { - if (ndepth == 1) { - /* -* Direct child node of the images parent node, -* i.e. component image node. -*/ - ret = fit_image_set_hashes(fit, noffset); - if (ret) - return ret; - } - } - - return 0; -} - -/** * fit_set_hash_value - set hash value in requested has node * @fit: pointer to the FIT format image header * @noffset: hash node offset @@ -125,33 +80,27 @@ static int fit_image_process_hash(void *fit, const char *image_name, int noffset, const void *data, size_t size) { uint8_t value[FIT_MAX_HASH_LEN]; + const char *node_name; int value_len; char *algo; - /* -* Check subnode name, must be equal to hash. -* Multiple hash nodes require unique unit node -* names, e.g. hash@1, hash@2, etc. -*/ - if (strncmp(fit_get_name(fit, noffset, NULL), - FIT_HASH_NODENAME, strlen(FIT_HASH_NODENAME)) != 0) - return 0; + node_name = fit_get_name(fit, noffset, NULL); if (fit_image_hash_get_algo(fit, noffset, algo)) { printf(Can't get hash algo property for '%s' hash node in '%s' image node\n, - fit_get_name(fit, noffset, NULL), image_name); + node_name, image_name); return -1; } if (calculate_hash(data, size, algo, value, value_len)) { printf(Unsupported hash algorithm (%s) for '%s' hash node in '%s' image node\n, - algo, fit_get_name(fit, noffset, NULL), image_name); + algo, node_name, image_name); return -1; } if (fit_set_hash_value(fit, noffset, value,
[U-Boot] [PATCH v3 12/19] image: Convert fit_image_hash_set_value() to static, and rename
This function doesn't need to be exported, and with verification we want to use it for setting the 'value' property in any node, so rename it. Signed-off-by: Simon Glass s...@chromium.org Reviewed-by: Marek Vasut ma...@denx.de --- Changes in v3: None Changes in v2: - Rebase on previous patches include/image.h| 2 -- tools/image-host.c | 62 +++--- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/include/image.h b/include/image.h index 21d9213..dc8f8b1 100644 --- a/include/image.h +++ b/include/image.h @@ -614,8 +614,6 @@ int fit_image_hash_get_ignore(const void *fit, int noffset, int *ignore); int fit_set_timestamp(void *fit, int noffset, time_t timestamp); int fit_set_hashes(void *fit); int fit_image_set_hashes(void *fit, int image_noffset); -int fit_image_hash_set_value(void *fit, int noffset, uint8_t *value, - int value_len); int fit_image_check_hashes(const void *fit, int noffset); int fit_all_image_check_hashes(const void *fit); diff --git a/tools/image-host.c b/tools/image-host.c index 6648215..a6b4f6b 100644 --- a/tools/image-host.c +++ b/tools/image-host.c @@ -79,6 +79,36 @@ int fit_set_hashes(void *fit) } /** + * fit_set_hash_value - set hash value in requested has node + * @fit: pointer to the FIT format image header + * @noffset: hash node offset + * @value: hash value to be set + * @value_len: hash value length + * + * fit_set_hash_value() attempts to set hash value in a node at offset + * given and returns operation status to the caller. + * + * returns + * 0, on success + * -1, on failure + */ +static int fit_set_hash_value(void *fit, int noffset, uint8_t *value, + int value_len) +{ + int ret; + + ret = fdt_setprop(fit, noffset, FIT_VALUE_PROP, value, value_len); + if (ret) { + printf(Can't set hash '%s' property for '%s' node(%s)\n, + FIT_VALUE_PROP, fit_get_name(fit, noffset, NULL), + fdt_strerror(ret)); + return -1; + } + + return 0; +} + +/** * fit_image_process_hash - Process a single subnode of the images/ node * * Check each subnode and process accordingly. For hash nodes we generate @@ -119,7 +149,7 @@ static int fit_image_process_hash(void *fit, const char *image_name, return -1; } - if (fit_image_hash_set_value(fit, noffset, value, value_len)) { + if (fit_set_hash_value(fit, noffset, value, value_len)) { printf(Can't set hash value for '%s' hash node in '%s' image node\n, fit_get_name(fit, noffset, NULL), image_name); return -1; @@ -187,33 +217,3 @@ int fit_image_set_hashes(void *fit, int image_noffset) return 0; } - -/** - * fit_image_hash_set_value - set hash value in requested has node - * @fit: pointer to the FIT format image header - * @noffset: hash node offset - * @value: hash value to be set - * @value_len: hash value length - * - * fit_image_hash_set_value() attempts to set hash value in a node at offset - * given and returns operation status to the caller. - * - * returns - * 0, on success - * -1, on failure - */ -int fit_image_hash_set_value(void *fit, int noffset, uint8_t *value, - int value_len) -{ - int ret; - - ret = fdt_setprop(fit, noffset, FIT_VALUE_PROP, value, value_len); - if (ret) { - printf(Can't set hash '%s' property for '%s' node(%s)\n, - FIT_VALUE_PROP, fit_get_name(fit, noffset, NULL), - fdt_strerror(ret)); - return -1; - } - - return 0; -} -- 1.8.2.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 05/19] mkimage: Move ARRAY_SIZE to header file
Move this definition from aisimage.c to mkimage.h so that it is available more widely. Signed-off-by: Simon Glass s...@chromium.org Acked-by: Marek Vasut ma...@denx.de --- Changes in v3: None Changes in v2: None tools/aisimage.c | 1 - tools/mkimage.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/aisimage.c b/tools/aisimage.c index c645708..659df8c 100644 --- a/tools/aisimage.c +++ b/tools/aisimage.c @@ -32,7 +32,6 @@ #define WORD_ALIGN04 #define WORD_ALIGN(len) (((len)+WORD_ALIGN0-1) ~(WORD_ALIGN0-1)) #define MAX_CMD_BUFFER 4096 -#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) static uint32_t ais_img_size; diff --git a/tools/mkimage.h b/tools/mkimage.h index ea45f5c..e07a615 100644 --- a/tools/mkimage.h +++ b/tools/mkimage.h @@ -42,6 +42,8 @@ #define debug(fmt,args...) #endif /* MKIMAGE_DEBUG */ +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + #define MKIMAGE_TMPFILE_SUFFIX .tmp #define MKIMAGE_MAX_TMPFILE_LEN256 #define MKIMAGE_DEFAULT_DTC_OPTIONS-I dts -O dtb -p 500 -- 1.8.2.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 14/19] image: Move hash checking into its own function
The existing function is long and most of the code is indented a long way. Before adding yet more code, split this out into its own function. Signed-off-by: Simon Glass s...@chromium.org Reviewed-by: Marek Vasut ma...@denx.de (v1) --- Changes in v3: None Changes in v2: - Add IMAGE_ENABLE_IGNORE to avoid #ifdef around ignore property handling - Rename commit message to say function instead of function - Rebase on previous patches common/image-fit.c | 128 - include/image.h| 8 ++-- 2 files changed, 72 insertions(+), 64 deletions(-) diff --git a/common/image-fit.c b/common/image-fit.c index 9360af2..fa21f18 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -748,7 +748,6 @@ int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value, return 0; } -#ifndef USE_HOSTCC /** * fit_image_hash_get_ignore - get hash ignore flag * @fit: pointer to the FIT format image header @@ -763,7 +762,7 @@ int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value, * 0, on ignore not found * value, on ignore found */ -int fit_image_hash_get_ignore(const void *fit, int noffset, int *ignore) +static int fit_image_hash_get_ignore(const void *fit, int noffset, int *ignore) { int len; int *value; @@ -776,7 +775,6 @@ int fit_image_hash_get_ignore(const void *fit, int noffset, int *ignore) return 0; } -#endif /** * fit_set_timestamp - set node timestamp property @@ -849,6 +847,57 @@ int calculate_hash(const void *data, int data_len, const char *algo, return 0; } +static int fit_image_check_hash(const void *fit, int noffset, const void *data, + size_t size, char **err_msgp) +{ + uint8_t value[FIT_MAX_HASH_LEN]; + int value_len; + char *algo; + uint8_t *fit_value; + int fit_value_len; + int ignore; + + *err_msgp = NULL; + + if (fit_image_hash_get_algo(fit, noffset, algo)) { + *err_msgp = error!\nCan't get hash algo + property; + return -1; + } + printf(%s, algo); + + if (IMAGE_ENABLE_IGNORE) { + fit_image_hash_get_ignore(fit, noffset, ignore); + if (ignore) { + printf(-skipped ); + return 0; + } + } + + if (fit_image_hash_get_value(fit, noffset, fit_value, +fit_value_len)) { + *err_msgp = error!\nCan't get hash value + property; + return -1; + } + + if (calculate_hash(data, size, algo, value, value_len)) { + *err_msgp = error!\n + Unsupported hash algorithm; + return -1; + } + + if (value_len != fit_value_len) { + *err_msgp = error !\nBad hash value len; + return -1; + } else if (memcmp(value, fit_value, value_len) != 0) { + *err_msgp = error!\nBad hash value; + return -1; + } + + return 0; +} + /** * fit_image_verify - verify data intergity * @fit: pointer to the FIT format image header @@ -866,14 +915,6 @@ int fit_image_verify(const void *fit, int image_noffset) { const void *data; size_t size; - char*algo; - uint8_t *fit_value; - int fit_value_len; -#ifndef USE_HOSTCC - int ignore; -#endif - uint8_t value[FIT_MAX_HASH_LEN]; - int value_len; int noffset; int ndepth; char*err_msg = ; @@ -885,58 +926,23 @@ int fit_image_verify(const void *fit, int image_noffset) } /* Process all hash subnodes of the component image node */ - for (ndepth = 0, noffset = fdt_next_node(fit, image_noffset, ndepth); -(noffset = 0) (ndepth 0); -noffset = fdt_next_node(fit, noffset, ndepth)) { - if (ndepth == 1) { - /* Direct child node of the component image node */ + for (ndepth = 0, + noffset = fdt_next_subnode(fit, image_noffset, ndepth); + noffset = 0; + noffset = fdt_next_subnode(fit, noffset, ndepth)) { + const char *name = fit_get_name(fit, noffset, NULL); - /* -* Check subnode name, must be equal to hash. -* Multiple hash nodes require unique unit node -* names, e.g. hash@1, hash@2, etc. -*/ - if (strncmp(fit_get_name(fit, noffset, NULL), - FIT_HASH_NODENAME, - strlen(FIT_HASH_NODENAME)) != 0) -
[U-Boot] [PATCH v3 18/19] image: Rename hash printing to fit_image_print_verification_data()
This function will be used to print signatures as well as hashes, so rename it. Also make it static since it is not used outside this file. Signed-off-by: Simon Glass s...@chromium.org Reviewed-by: Marek Vasut ma...@denx.de --- Changes in v3: None Changes in v2: - Rebase on previous patches common/image-fit.c | 131 - include/image.h| 1 - 2 files changed, 79 insertions(+), 53 deletions(-) diff --git a/common/image-fit.c b/common/image-fit.c index b8a1eb4..5dcb0c6 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -229,6 +229,84 @@ void fit_print_contents(const void *fit) } /** + * fit_image_print_data() - prints out the hash node details + * @fit: pointer to the FIT format image header + * @noffset: offset of the hash node + * @p: pointer to prefix string + * + * fit_image_print_data() lists properies for the processed hash node + * + * returns: + * no returned results + */ +static void fit_image_print_data(const void *fit, int noffset, const char *p) +{ + char *algo; + uint8_t *value; + int value_len; + int i, ret; + + /* +* Check subnode name, must be equal to hash. +* Multiple hash nodes require unique unit node +* names, e.g. hash@1, hash@2, etc. +*/ + if (strncmp(fit_get_name(fit, noffset, NULL), + FIT_HASH_NODENAME, + strlen(FIT_HASH_NODENAME)) != 0) + return; + + debug(%s Hash node:'%s'\n, p, + fit_get_name(fit, noffset, NULL)); + + printf(%s Hash algo:, p); + if (fit_image_hash_get_algo(fit, noffset, algo)) { + printf(invalid/unsupported\n); + return; + } + printf(%s\n, algo); + + ret = fit_image_hash_get_value(fit, noffset, value, + value_len); + printf(%s Hash value: , p); + if (ret) { + printf(unavailable\n); + } else { + for (i = 0; i value_len; i++) + printf(%02x, value[i]); + printf(\n); + } + + debug(%s Hash len: %d\n, p, value_len); +} + +/** + * fit_image_print_verification_data() - prints out the hash/signature details + * @fit: pointer to the FIT format image header + * @noffset: offset of the hash or signature node + * @p: pointer to prefix string + * + * This lists properies for the processed hash node + * + * returns: + * no returned results + */ +static void fit_image_print_verification_data(const void *fit, int noffset, + const char *p) +{ + const char *name; + + /* +* Check subnode name, must be equal to hash or signature. +* Multiple hash/signature nodes require unique unit node +* names, e.g. hash@1, hash@2, signature@1, signature@2, etc. +*/ + name = fit_get_name(fit, noffset, NULL); + if (!strncmp(name, FIT_HASH_NODENAME, strlen(FIT_HASH_NODENAME))) + fit_image_print_data(fit, noffset, p); +} + +/** * fit_image_print - prints out the FIT component image details * @fit: pointer to the FIT format image header * @image_noffset: offset of the component image node @@ -323,63 +401,12 @@ void fit_image_print(const void *fit, int image_noffset, const char *p) noffset = fdt_next_node(fit, noffset, ndepth)) { if (ndepth == 1) { /* Direct child node of the component image node */ - fit_image_print_hash(fit, noffset, p); + fit_image_print_verification_data(fit, noffset, p); } } } /** - * fit_image_print_hash - prints out the hash node details - * @fit: pointer to the FIT format image header - * @noffset: offset of the hash node - * @p: pointer to prefix string - * - * fit_image_print_hash() lists properies for the processed hash node - * - * returns: - * no returned results - */ -void fit_image_print_hash(const void *fit, int noffset, const char *p) -{ - char *algo; - uint8_t *value; - int value_len; - int i, ret; - - /* -* Check subnode name, must be equal to hash. -* Multiple hash nodes require unique unit node -* names, e.g. hash@1, hash@2, etc. -*/ - if (strncmp(fit_get_name(fit, noffset, NULL), - FIT_HASH_NODENAME, strlen(FIT_HASH_NODENAME)) != 0) - return; - - debug(%s Hash node:'%s'\n, p, - fit_get_name(fit, noffset, NULL)); - - printf(%s Hash algo:, p); - if (fit_image_hash_get_algo(fit, noffset, algo)) { - printf(invalid/unsupported\n); - return; - } - printf(%s\n, algo); - - ret = fit_image_hash_get_value(fit, noffset, value, - value_len); - printf(%s Hash value: , p); - if (ret) { -
[U-Boot] [PATCH v3 10/19] image: Move HOSTCC image code to tools/
This code is never compiled into U-Boot, so move it into a separate file in tools/ to avoid the large #ifdef. Signed-off-by: Simon Glass s...@chromium.org Reviewed-by: Marek Vasut ma...@denx.de --- Changes in v3: None Changes in v2: - Rebase on previous patches common/image-fit.c | 171 + include/image.h| 3 + tools/Makefile | 2 + tools/image-host.c | 201 + 4 files changed, 207 insertions(+), 170 deletions(-) create mode 100644 tools/image-host.c diff --git a/common/image-fit.c b/common/image-fit.c index 3ba1ad3..3e72da0 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -827,7 +827,7 @@ int fit_set_timestamp(void *fit, int noffset, time_t timestamp) * 0, on success *-1, when algo is unsupported */ -static int calculate_hash(const void *data, int data_len, const char *algo, +int calculate_hash(const void *data, int data_len, const char *algo, uint8_t *value, int *value_len) { if (strcmp(algo, crc32) == 0) { @@ -849,175 +849,6 @@ static int calculate_hash(const void *data, int data_len, const char *algo, return 0; } -#ifdef USE_HOSTCC -/** - * fit_set_hashes - process FIT component image nodes and calculate hashes - * @fit: pointer to the FIT format image header - * - * fit_set_hashes() adds hash values for all component images in the FIT blob. - * Hashes are calculated for all component images which have hash subnodes - * with algorithm property set to one of the supported hash algorithms. - * - * returns - * 0, on success - * libfdt error code, on failure - */ -int fit_set_hashes(void *fit) -{ - int images_noffset; - int noffset; - int ndepth; - int ret; - - /* Find images parent node offset */ - images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH); - if (images_noffset 0) { - printf(Can't find images parent node '%s' (%s)\n, - FIT_IMAGES_PATH, fdt_strerror(images_noffset)); - return images_noffset; - } - - /* Process its subnodes, print out component images details */ - for (ndepth = 0, noffset = fdt_next_node(fit, images_noffset, ndepth); -(noffset = 0) (ndepth 0); -noffset = fdt_next_node(fit, noffset, ndepth)) { - if (ndepth == 1) { - /* -* Direct child node of the images parent node, -* i.e. component image node. -*/ - ret = fit_image_set_hashes(fit, noffset); - if (ret) - return ret; - } - } - - return 0; -} - -/** - * fit_image_set_hashes - calculate/set hashes for given component image node - * @fit: pointer to the FIT format image header - * @image_noffset: requested component image node - * - * fit_image_set_hashes() adds hash values for an component image node. All - * existing hash subnodes are checked, if algorithm property is set to one of - * the supported hash algorithms, hash value is computed and corresponding - * hash node property is set, for example: - * - * Input component image node structure: - * - * o image@1 (at image_noffset) - * | - data = [binary data] - * o hash@1 - * |- algo = sha1 - * - * Output component image node structure: - * - * o image@1 (at image_noffset) - * | - data = [binary data] - * o hash@1 - * |- algo = sha1 - * |- value = sha1(data) - * - * returns: - * 0 on sucess - *0 on failure - */ -int fit_image_set_hashes(void *fit, int image_noffset) -{ - const void *data; - size_t size; - char *algo; - uint8_t value[FIT_MAX_HASH_LEN]; - int value_len; - int noffset; - int ndepth; - - /* Get image data and data length */ - if (fit_image_get_data(fit, image_noffset, data, size)) { - printf(Can't get image data/size\n); - return -1; - } - - /* Process all hash subnodes of the component image node */ - for (ndepth = 0, noffset = fdt_next_node(fit, image_noffset, ndepth); -(noffset = 0) (ndepth 0); -noffset = fdt_next_node(fit, noffset, ndepth)) { - if (ndepth == 1) { - /* Direct child node of the component image node */ - - /* -* Check subnode name, must be equal to hash. -* Multiple hash nodes require unique unit node -* names, e.g. hash@1, hash@2, etc. -*/ - if (strncmp(fit_get_name(fit, noffset, NULL), - FIT_HASH_NODENAME, - strlen(FIT_HASH_NODENAME)) != 0) { - /* Not a hash subnode, skip it */ -
[U-Boot] [PATCH v3 08/19] image: Export fit_check_ramdisk()
One we split out the FIT code from image.c we will need this function. Export it in the header. Signed-off-by: Simon Glass s...@chromium.org Reviewed-by: Marek Vasut ma...@denx.de --- Changes in v3: None Changes in v2: None common/image.c | 9 ++--- include/image.h | 3 +++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/common/image.c b/common/image.c index b415c4e..7b48564 100644 --- a/common/image.c +++ b/common/image.c @@ -49,14 +49,9 @@ #include fdt_support.h #endif -#if defined(CONFIG_FIT) #include u-boot/md5.h #include sha1.h -static int fit_check_ramdisk(const void *fit, int os_noffset, - uint8_t arch, int verify); -#endif - #ifdef CONFIG_CMD_BDI extern int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); #endif @@ -3364,8 +3359,8 @@ void fit_conf_print(const void *fit, int noffset, const char *p) * 0, on failure */ #ifndef USE_HOSTCC -static int fit_check_ramdisk(const void *fit, int rd_noffset, uint8_t arch, - int verify) +int fit_check_ramdisk(const void *fit, int rd_noffset, uint8_t arch, + int verify) { fit_image_print(fit, rd_noffset,); diff --git a/include/image.h b/include/image.h index d2325dd..7149cba 100644 --- a/include/image.h +++ b/include/image.h @@ -633,6 +633,9 @@ int fit_conf_get_fdt_node(const void *fit, int noffset); void fit_conf_print(const void *fit, int noffset, const char *p); +int fit_check_ramdisk(const void *fit, int os_noffset, + uint8_t arch, int verify); + #ifndef USE_HOSTCC static inline int fit_image_check_target_arch(const void *fdt, int node) { -- 1.8.2.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 07/19] image: Move timestamp #ifdefs to header file
Rather than repeat the line #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || \ defined(USE_HOSTCC) everywhere, put this in a header file and #define IMAGE_ENABLE_TIMESTAMP to either 1 or 0. Then we can use a plain if() in most code and avoid the #ifdefs. The compiler's dead code elimination ensures that the result is the same. Signed-off-by: Simon Glass s...@chromium.org Acked-by: Marek Vasut ma...@denx.de --- Changes in v3: None Changes in v2: None common/image.c | 50 +- include/image.h | 8 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/common/image.c b/common/image.c index 60c2127..b415c4e 100644 --- a/common/image.c +++ b/common/image.c @@ -39,9 +39,7 @@ #include logbuff.h #endif -#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) #include rtc.h -#endif #include environment.h #include image.h @@ -163,10 +161,6 @@ static const table_entry_t uimage_comp[] = { { -1, , , }, }; -#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || defined(USE_HOSTCC) -static void genimg_print_time(time_t timestamp); -#endif - /*/ /* Legacy format routines */ /*/ @@ -312,10 +306,10 @@ void image_print_contents(const void *ptr) #endif printf(%sImage Name: %.*s\n, p, IH_NMLEN, image_get_name(hdr)); -#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || defined(USE_HOSTCC) - printf(%sCreated: , p); - genimg_print_time((time_t)image_get_time(hdr)); -#endif + if (IMAGE_ENABLE_TIMESTAMP) { + printf(%sCreated: , p); + genimg_print_time((time_t)image_get_time(hdr)); + } printf(%sImage Type: , p); image_print_type(hdr); printf(%sData Size:, p); @@ -524,8 +518,8 @@ void genimg_print_size(uint32_t size) #endif } -#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || defined(USE_HOSTCC) -static void genimg_print_time(time_t timestamp) +#if IMAGE_ENABLE_TIMESTAMP +void genimg_print_time(time_t timestamp) { #ifndef USE_HOSTCC struct rtc_time tm; @@ -538,7 +532,7 @@ static void genimg_print_time(time_t timestamp) printf(%s, ctime(timestamp)); #endif } -#endif /* CONFIG_TIMESTAMP || CONFIG_CMD_DATE || USE_HOSTCC */ +#endif /** * get_table_entry_name - translate entry id to long name @@ -1911,9 +1905,7 @@ void fit_print_contents(const void *fit) int count = 0; int ret; const char *p; -#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || defined(USE_HOSTCC) time_t timestamp; -#endif #ifdef USE_HOSTCC p = ; @@ -1929,14 +1921,14 @@ void fit_print_contents(const void *fit) else printf(%s\n, desc); -#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || defined(USE_HOSTCC) - ret = fit_get_timestamp(fit, 0, timestamp); - printf(%sCreated: , p); - if (ret) - printf(unavailable\n); - else - genimg_print_time(timestamp); -#endif + if (IMAGE_ENABLE_TIMESTAMP) { + ret = fit_get_timestamp(fit, 0, timestamp); + printf(%sCreated: , p); + if (ret) + printf(unavailable\n); + else + genimg_print_time(timestamp); + } /* Find images parent node offset */ images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH); @@ -3047,13 +3039,13 @@ int fit_check_format(const void *fit) return 0; } -#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || defined(USE_HOSTCC) - /* mandatory / node 'timestamp' property */ - if (fdt_getprop(fit, 0, FIT_TIMESTAMP_PROP, NULL) == NULL) { - debug(Wrong FIT format: no timestamp\n); - return 0; + if (IMAGE_ENABLE_TIMESTAMP) { + /* mandatory / node 'timestamp' property */ + if (fdt_getprop(fit, 0, FIT_TIMESTAMP_PROP, NULL) == NULL) { + debug(Wrong FIT format: no timestamp\n); + return 0; + } } -#endif /* mandatory subimages parent '/images' node */ if (fdt_path_offset(fit, FIT_IMAGES_PATH) 0) { diff --git a/include/image.h b/include/image.h index 4ad0e6b..d2325dd 100644 --- a/include/image.h +++ b/include/image.h @@ -333,6 +333,14 @@ int genimg_get_type_id(const char *name); int genimg_get_comp_id(const char *name); void genimg_print_size(uint32_t size); +#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || \ + defined(USE_HOSTCC) +#define IMAGE_ENABLE_TIMESTAMP 1 +#else +#define IMAGE_ENABLE_TIMESTAMP 0 +#endif +void genimg_print_time(time_t timestamp); + #ifndef
[U-Boot] [PATCH v3 16/19] image: Export fit_conf_get_prop_node()
This function will be needed by signature checking code, so export it, and also add docs. Signed-off-by: Simon Glass s...@chromium.org --- Changes in v3: None Changes in v2: - Put params before description in fit_conf_get_prop_node() comment common/image-fit.c | 8 include/image.h| 14 ++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/common/image-fit.c b/common/image-fit.c index 97f8521..b8a1eb4 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -1310,7 +1310,7 @@ int fit_conf_get_node(const void *fit, const char *conf_uname) return noffset; } -static int __fit_conf_get_prop_node(const void *fit, int noffset, +int fit_conf_get_prop_node(const void *fit, int noffset, const char *prop_name) { char *uname; @@ -1340,7 +1340,7 @@ static int __fit_conf_get_prop_node(const void *fit, int noffset, */ int fit_conf_get_kernel_node(const void *fit, int noffset) { - return __fit_conf_get_prop_node(fit, noffset, FIT_KERNEL_PROP); + return fit_conf_get_prop_node(fit, noffset, FIT_KERNEL_PROP); } /** @@ -1359,7 +1359,7 @@ int fit_conf_get_kernel_node(const void *fit, int noffset) */ int fit_conf_get_ramdisk_node(const void *fit, int noffset) { - return __fit_conf_get_prop_node(fit, noffset, FIT_RAMDISK_PROP); + return fit_conf_get_prop_node(fit, noffset, FIT_RAMDISK_PROP); } /** @@ -1378,7 +1378,7 @@ int fit_conf_get_ramdisk_node(const void *fit, int noffset) */ int fit_conf_get_fdt_node(const void *fit, int noffset) { - return __fit_conf_get_prop_node(fit, noffset, FIT_FDT_PROP); + return fit_conf_get_prop_node(fit, noffset, FIT_FDT_PROP); } /** diff --git a/include/image.h b/include/image.h index 507ce42..6d7cd54 100644 --- a/include/image.h +++ b/include/image.h @@ -631,6 +631,20 @@ int fit_conf_get_kernel_node(const void *fit, int noffset); int fit_conf_get_ramdisk_node(const void *fit, int noffset); int fit_conf_get_fdt_node(const void *fit, int noffset); +/** + * fit_conf_get_prop_node() - Get node refered to by a configuration + * @fit: FIT to check + * @noffset: Offset of conf@xxx node to check + * @prop_name: Property to read from the conf node + * + * The conf@ nodes contain references to other nodes, using properties + * like 'kernel = kernel@1'. Given such a property name (e.g. kernel), + * return the offset of the node referred to (e.g. offset of node + * /images/kernel@1. + */ +int fit_conf_get_prop_node(const void *fit, int noffset, + const char *prop_name); + void fit_conf_print(const void *fit, int noffset, const char *p); int fit_check_ramdisk(const void *fit, int os_noffset, -- 1.8.2.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 13/19] image: Rename fit_image_check_hashes() to fit_image_verify()
This is the main entry point to the FIT image verification code. We will be using it to handle image verification with signatures, so rename the function. Signed-off-by: Simon Glass s...@chromium.org Reviewed-by: Marek Vasut ma...@denx.de --- Changes in v3: None Changes in v2: None common/cmd_bootm.c | 4 ++-- common/cmd_fpga.c | 2 +- common/cmd_source.c | 2 +- common/cmd_ximg.c | 2 +- common/image-fit.c | 16 common/image.c | 2 +- common/update.c | 2 +- include/image.h | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 7438469..aa717bf 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -815,7 +815,7 @@ static int fit_check_kernel(const void *fit, int os_noffset, int verify) if (verify) { puts( Verifying Hash Integrity ... ); - if (!fit_image_check_hashes(fit, os_noffset)) { + if (!fit_image_verify(fit, os_noffset)) { puts(Bad Data Hash\n); bootstage_error(BOOTSTAGE_ID_FIT_CHECK_HASH); return 0; @@ -1169,7 +1169,7 @@ static int image_info(ulong addr) fit_print_contents(hdr); - if (!fit_all_image_check_hashes(hdr)) { + if (!fit_all_image_verify(hdr)) { puts(Bad hash in FIT image!\n); return 1; } diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c index 1834246..1341604 100644 --- a/common/cmd_fpga.c +++ b/common/cmd_fpga.c @@ -306,7 +306,7 @@ int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) } /* verify integrity */ - if (!fit_image_check_hashes (fit_hdr, noffset)) { + if (!fit_image_verify(fit_hdr, noffset)) { puts (Bad Data Hash\n); return 1; } diff --git a/common/cmd_source.c b/common/cmd_source.c index f0d7f52..a440614 100644 --- a/common/cmd_source.c +++ b/common/cmd_source.c @@ -127,7 +127,7 @@ source (ulong addr, const char *fit_uname) /* verify integrity */ if (verify) { - if (!fit_image_check_hashes (fit_hdr, noffset)) { + if (!fit_image_verify(fit_hdr, noffset)) { puts (Bad Data Hash\n); return 1; } diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c index ea0a26e..f8722a0 100644 --- a/common/cmd_ximg.c +++ b/common/cmd_ximg.c @@ -160,7 +160,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) /* verify integrity */ if (verify) { - if (!fit_image_check_hashes(fit_hdr, noffset)) { + if (!fit_image_verify(fit_hdr, noffset)) { puts(Bad Data Hash\n); return 1; } diff --git a/common/image-fit.c b/common/image-fit.c index 3e72da0..9360af2 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -850,11 +850,11 @@ int calculate_hash(const void *data, int data_len, const char *algo, } /** - * fit_image_check_hashes - verify data intergity + * fit_image_verify - verify data intergity * @fit: pointer to the FIT format image header * @image_noffset: component image node offset * - * fit_image_check_hashes() goes over component image hash nodes, + * fit_image_verify() goes over component image hash nodes, * re-calculates each data hash and compares with the value stored in hash * node. * @@ -862,7 +862,7 @@ int calculate_hash(const void *data, int data_len, const char *algo, * 1, if all hashes are valid * 0, otherwise (or on error) */ -int fit_image_check_hashes(const void *fit, int image_noffset) +int fit_image_verify(const void *fit, int image_noffset) { const void *data; size_t size; @@ -955,17 +955,17 @@ error: } /** - * fit_all_image_check_hashes - verify data intergity for all images + * fit_all_image_verify - verify data intergity for all images * @fit: pointer to the FIT format image header * - * fit_all_image_check_hashes() goes over all images in the FIT and + * fit_all_image_verify() goes over all images in the FIT and * for every images checks if all it's hashes are valid. * * returns: * 1, if all hashes of all images are valid * 0, otherwise (or on error) */ -int fit_all_image_check_hashes(const void *fit) +int fit_all_image_verify(const void *fit) { int images_noffset; int noffset; @@ -995,7 +995,7 @@ int fit_all_image_check_hashes(const void *fit) printf( Hash(es) for Image %u (%s): ,
[U-Boot] [PATCH v3 19/19] sandbox: image: Add support for booting images in sandbox
Much of the image code uses addresses as ulongs and pointers interchangeably, casting between the two forms as needed. This doesn't work with sandbox, which has a U-Boot RAM buffer which is separate from the host machine's memory. Adjust the cost so that translating from a U-Boot address to a pointer uses map_sysmem(). This allows bootm to work correctly on sandbox. Note that there are no exhaustive tests for this code on sandbox, so it is possible that some dark corners remain. Signed-off-by: Simon Glass s...@chromium.org Reviewed-by: Marek Vasut ma...@denx.de (v1) --- Changes in v3: - Split out image improvements into a separate series Changes in v2: - Fix checkpatch checks about parenthesis alignment common/cmd_bootm.c | 21 - common/image.c | 48 include/image.h| 2 +- 3 files changed, 41 insertions(+), 30 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index aa717bf..b9b2979 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -36,6 +36,7 @@ #include lmb.h #include linux/ctype.h #include asm/byteorder.h +#include asm/io.h #include linux/compiler.h #if defined(CONFIG_CMD_USB) @@ -97,7 +98,7 @@ static image_header_t *image_get_kernel(ulong img_addr, int verify); static int fit_check_kernel(const void *fit, int os_noffset, int verify); #endif -static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, +static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], bootm_headers_t *images, ulong *os_data, ulong *os_len); @@ -203,8 +204,8 @@ static inline void boot_start_lmb(bootm_headers_t *images) { } static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - void*os_hdr; - int ret; + const void *os_hdr; + int ret; memset((void *)images, 0, sizeof(images)); images.verify = getenv_yesno(verify); @@ -855,14 +856,15 @@ static int fit_check_kernel(const void *fit, int os_noffset, int verify) * pointer to image header if valid image was found, plus kernel start * address and length, otherwise NULL */ -static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, +static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], bootm_headers_t *images, ulong *os_data, ulong *os_len) { image_header_t *hdr; ulong img_addr; + const void *buf; #if defined(CONFIG_FIT) - void*fit_hdr; + const void *fit_hdr; const char *fit_uname_config = NULL; const char *fit_uname_kernel = NULL; const void *data; @@ -898,7 +900,8 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, /* check image type, for FIT images get FIT kernel node */ *os_data = *os_len = 0; - switch (genimg_get_format((void *)img_addr)) { + buf = map_sysmem(img_addr, 0); + switch (genimg_get_format(buf)) { case IMAGE_FORMAT_LEGACY: printf(## Booting kernel from Legacy Image at %08lx ...\n, img_addr); @@ -943,7 +946,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, break; #if defined(CONFIG_FIT) case IMAGE_FORMAT_FIT: - fit_hdr = (void *)img_addr; + fit_hdr = buf; printf(## Booting kernel from FIT Image at %08lx ...\n, img_addr); @@ -1020,7 +1023,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, *os_len = len; *os_data = (ulong)data; - images-fit_hdr_os = fit_hdr; + images-fit_hdr_os = (void *)fit_hdr; images-fit_uname_os = fit_uname_kernel; images-fit_noffset_os = os_noffset; break; @@ -1034,7 +1037,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, debug( kernel data at 0x%08lx, len = 0x%08lx (%ld)\n, *os_data, *os_len, *os_len); - return (void *)img_addr; + return buf; } #ifdef CONFIG_SYS_LONGHELP diff --git a/common/image.c b/common/image.c index 7412a0e..564ed90 100644 --- a/common/image.c +++ b/common/image.c @@ -51,6 +51,7 @@ #include u-boot/md5.h #include sha1.h +#include asm/io.h #ifdef CONFIG_CMD_BDI extern int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); @@ -90,6 +91,7 @@ static const table_entry_t uimage_arch[] = { { IH_ARCH_AVR32, avr32,AVR32,}, { IH_ARCH_NDS32, nds32,NDS32,}, { IH_ARCH_OPENRISC, or1k, OpenRISC 1000,}, + { IH_ARCH_SANDBOX,sandbox,
Re: [U-Boot] Driver Model Thoughts
Hi Marek, On Mon, Apr 22, 2013 at 2:00 AM, Marek Vasut ma...@denx.de wrote: Hi Simon, Hi Marek, Another U-Boot engineer and I are looking at running up driver model. Good, I'm now free of the shackles of the university project. Bring it on. It seems to work in sandbox quite nicely. I had half a mind to try to get some core patches together for this merge window, but have questions. For 'struct instance' it seems to be an attempt to keep the constant data separate from the dynamic data to reduce early RAM usage. But when I look at struct driver_instance, it seems to have a 'struct instance' within it (not a pointer). So doesn't this defeat that benefit? You presumably can't put struct driver_instance in read-only memory because you need it updates its flags. Honestly, I can't tell. I was never able to properly understand it from Pavel's explanation. OK, I guess we need to make this work so we will have a think about it. I still have trouble keeping track of some of the naming - e.g. and instance feels to me like it should be called a device, and the naming of 'core' seems odd although I do understand the concept. Also bind/unbind seems like register/unregister to me - but maybe there is a difference. There is: struct driver_info struct instance struct core_instance struct driver_instance struct u_boot_driver struct u_boot_core Anyway I'll leave that alone for now. There seems to be a lot of boilerplate code about. For example the bind/unbind methods just call a core_...() function and it seems that the core library could do this itself. It seems to me that some of the methods could be NULL for most drivers, and that would reduce the porting effort. If we do this I would like to build in device tree from the start so that on boards that use CONFIG_OF_CONTROL there is no need for static data. I think the existing 'demo' driver is a really good idea since it gives people something to copy. The driver model has one fundamental flaw -- when used with SPL (where you usually have one single device for everything), it's not optimized away and only brings in overhead. That's why I'd love to see some more work put into this. Are you talking about using static init of the tables or actually not having driver model infrastructure at all in SPL? For the single device I assume you mean the storage device holding U-Boot. How much overhead is added in this case? I wonder what an acceptable overhead is? Expecting it to be totally optimised away seems ambitious - for one thing how will the driver code be called if not through dm? Another thing that comes to mind are those .bind()/.unbind() calls which make porting drivers from Linux harder. Yet they make sense as they produce an in- memory representation of the driver tree without starting the hardware. Another I think they can mostly just be NULL, with dm doing the work in the common case. thing I never understood that Pavel mentioned is that sometimes the hardware must be started so that .bind() can be successfully finished. This was probably since it is sometimes uncertain to which cores the hardware can provide services. In that case I suggest we have bind do the minimum it can (add the driver into the structures with the single known parent perhaps) and then let probe add new bindings. An example might be USB where it can add a network device when it starts up. But in that case we won't even find the device until we start up USB. btw. building in DT from the start would be a nice idea. I'd say we should re- think the design first and maybe align it a bit more with Linux kernel. Yes makes sense. We at least need to make sure that each deviation is for a good reason. I would prefer that the naming becomes a little more similar. I mostly understand the bind/unbind side, but I want to at least ask the question as to whether it would be possible to delay the binding until we do the probe, which is delayed until we need the device? We actually have a full list of drivers in the image anyway if we care to look - so we can create a list of devices anytime we want. Perhaps a 'lazy' approach to binding makes some sense? That would fit well with things like USB which have to have delayed binding/probing anyway.\ I'm still getting my head around this stuff though. Best regards, Marek Vasut Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] usb: common: Use a global definition for 'min3'
On Fri, Apr 19, 2013 at 01:29:12PM +0200, Marek Vasut wrote: Dear Vivek Gautam, We can use a common global method for calculating minimum of 3 numbers. Put the same in 'common header' and let 'ehci' use it. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com Applied, thanks NAK, sorry. Lets re-sync with the kernel's min/max/min3/max3 defines here instead. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3 03/17] sandbox: Add support for generic board
On Sat, Apr 20, 2013 at 11:42:38AM -0700, Simon Glass wrote: Add generic board support for sandbox. [snip] diff --git a/arch/sandbox/include/asm/u-boot.h b/arch/sandbox/include/asm/u-boot.h index de8120a..7b93acb 100644 --- a/arch/sandbox/include/asm/u-boot.h +++ b/arch/sandbox/include/asm/u-boot.h @@ -36,6 +36,11 @@ #ifndef _U_BOOT_H_ #define _U_BOOT_H_ 1 +#ifdef CONFIG_SYS_GENERIC_BOARD +/* Use the generic board which requires a unified bd_info */ +#include asm-generic/u-boot.h +#else You're converting the whole arch here, so just drop the non-CONFIG_SYS_GENERIC_BOARD code? [snip] diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile index fbe579b..b1ae168 100644 --- a/arch/sandbox/lib/Makefile +++ b/arch/sandbox/lib/Makefile @@ -27,7 +27,9 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(ARCH).o +ifndef CONFIG_SYS_GENERIC_BOARD COBJS-y += board.o +endif Then board.c goes away too. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3 03/17] sandbox: Add support for generic board
On Mon, Apr 22, 2013 at 10:03:10AM -0400, Tom Rini wrote: On Sat, Apr 20, 2013 at 11:42:38AM -0700, Simon Glass wrote: Add generic board support for sandbox. [snip] diff --git a/arch/sandbox/include/asm/u-boot.h b/arch/sandbox/include/asm/u-boot.h index de8120a..7b93acb 100644 --- a/arch/sandbox/include/asm/u-boot.h +++ b/arch/sandbox/include/asm/u-boot.h @@ -36,6 +36,11 @@ #ifndef _U_BOOT_H_ #define _U_BOOT_H_ 1 +#ifdef CONFIG_SYS_GENERIC_BOARD +/* Use the generic board which requires a unified bd_info */ +#include asm-generic/u-boot.h +#else You're converting the whole arch here, so just drop the non-CONFIG_SYS_GENERIC_BOARD code? [snip] diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile index fbe579b..b1ae168 100644 --- a/arch/sandbox/lib/Makefile +++ b/arch/sandbox/lib/Makefile @@ -27,7 +27,9 @@ include $(TOPDIR)/config.mk LIB= $(obj)lib$(ARCH).o +ifndef CONFIG_SYS_GENERIC_BOARD COBJS-y+= board.o +endif Then board.c goes away too. In short, squash 3/4/5 into one patch. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/4] microblaze: Fix reset function
From: Michal Simek mon...@monstr.eu Remove CONFIG_SYS_RESET_ADDRESS macro. It was there from historical point of view when soft reset was just jump to u-boot text start (not used right now). Signed-off-by: Michal Simek mon...@monstr.eu Signed-off-by: Michal Simek michal.si...@xilinx.com --- board/xilinx/microblaze-generic/microblaze-generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c index 70f94c1..8ba99f9 100644 --- a/board/xilinx/microblaze-generic/microblaze-generic.c +++ b/board/xilinx/microblaze-generic/microblaze-generic.c @@ -38,10 +38,10 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) *((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)) = ++(*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR))); #endif -#ifdef CONFIG_SYS_RESET_ADDRESS + puts (Reseting board\n); asm (bra r0); -#endif + return 0; } -- 1.8.2.1 pgpW_OYNhEyge.pgp Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/4] microblaze: Enable netconsole
From: Michal Simek mon...@monstr.eu Setup environment and enable netconsole. Signed-off-by: Michal Simek mon...@monstr.eu Signed-off-by: Michal Simek michal.si...@xilinx.com --- include/configs/microblaze-generic.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h index d172e56..2b7ccf4 100644 --- a/include/configs/microblaze-generic.h +++ b/include/configs/microblaze-generic.h @@ -414,10 +414,17 @@ nor0=flash-0\0\ mtdparts=mtdparts=flash-0:\ 256k(u-boot),256k(env),3m(kernel),\ - 1m(romfs),1m(cramfs),-(jffs2)\0 + 1m(romfs),1m(cramfs),-(jffs2)\0\ + nc=setenv stdout nc\;\ + setenv stdin nc\0 \ + serial=setenv stdout serial;\ + setenv stdin serial\0 #define CONFIG_CMDLINE_EDITING +#define CONFIG_NETCONSOLE 1 +#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 + /* Use the HUSH parser */ #define CONFIG_SYS_HUSH_PARSER -- 1.8.2.1 pgpPmFVMMnVhN.pgp Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 4/4] watchdog: Add support for Xilinx Microblaze watchdog
Watchdog can be used on Microblaze, PPC and Zynq hw designs. Signed-off-by: Michal Simek michal.si...@xilinx.com --- arch/microblaze/include/asm/processor.h| 4 + arch/microblaze/lib/board.c| 3 + .../xilinx/microblaze-generic/microblaze-generic.c | 4 + doc/README.watchdog| 3 + drivers/watchdog/Makefile | 1 + drivers/watchdog/xilinx_tb_wdt.c | 86 ++ include/configs/microblaze-generic.h | 8 ++ 7 files changed, 109 insertions(+) create mode 100644 drivers/watchdog/xilinx_tb_wdt.c diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h index 2c4d5ff..9d19dda 100644 --- a/arch/microblaze/include/asm/processor.h +++ b/arch/microblaze/include/asm/processor.h @@ -31,4 +31,8 @@ extern char __text_start[]; /* Microblaze board initialization function */ void board_init(void); +/* Watchdog functions */ +int hw_watchdog_init(void); +void hw_watchdog_disable(void); + #endif /* __ASM_MICROBLAZE_PROCESSOR_H */ diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c index a7c2f76..815fb5a 100644 --- a/arch/microblaze/lib/board.c +++ b/arch/microblaze/lib/board.c @@ -61,6 +61,9 @@ init_fnc_t *init_sequence[] = { serial_init, console_init_f, interrupts_init, +#ifdef CONFIG_XILINX_TB_WATCHDOG + hw_watchdog_init, +#endif timer_init, NULL, }; diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c index 1af0b86..befbb3a 100644 --- a/board/xilinx/microblaze-generic/microblaze-generic.c +++ b/board/xilinx/microblaze-generic/microblaze-generic.c @@ -39,6 +39,10 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ++(*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR))); #endif +#ifdef CONFIG_XILINX_TB_WATCHDOG + hw_watchdog_disable(); +#endif + puts (Reseting board\n); __asm__ __volatile__ ( mts rmsr, r0; \ bra r0); diff --git a/doc/README.watchdog b/doc/README.watchdog index ee65008..33f31c2 100644 --- a/doc/README.watchdog +++ b/doc/README.watchdog @@ -27,3 +27,6 @@ CONFIG_IMX_WATCHDOG Available for i.mx31/35/5x/6x to service the watchdog. This is not automatically set because some boards (vision2) still need to define their own hw_watchdog_reset routine. + +CONFIG_XILINX_TB_WATCHDOG + Available for Xilinx Axi platforms to service timebase watchdog timer. diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index b1f4e0f..13e7c37 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -32,6 +32,7 @@ COBJS-y += imx_watchdog.o endif COBJS-$(CONFIG_TNETV107X_WATCHDOG) += tnetv107x_wdt.o COBJS-$(CONFIG_S5P) += s5p_wdt.o +COBJS-$(CONFIG_XILINX_TB_WATCHDOG) += xilinx_tb_wdt.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/watchdog/xilinx_tb_wdt.c b/drivers/watchdog/xilinx_tb_wdt.c new file mode 100644 index 000..0c1f0d6 --- /dev/null +++ b/drivers/watchdog/xilinx_tb_wdt.c @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2011-2013 Xilinx Inc. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include common.h +#include asm/io.h +#include asm/microblaze_intc.h +#include asm/processor.h +#include watchdog.h + +#define XWT_CSR0_WRS_MASK 0x0008 /* Reset status Mask */ +#define XWT_CSR0_WDS_MASK 0x0004 /* Timer state Mask */ +#define XWT_CSR0_EWDT1_MASK0x0002 /* Enable bit 1 Mask*/ +#define XWT_CSRX_EWDT2_MASK0x0001 /* Enable bit 2 Mask */ + +struct watchdog_regs { + u32 twcsr0; /* 0x0 */ + u32 twcsr1; /* 0x4 */ + u32 tbr; /* 0x8 */ +}; + +#define watchdog_base ((struct watchdog_regs *)CONFIG_WATCHDOG_BASEADDR) + +void hw_watchdog_reset(void) +{ + u32 reg; + + /* Read the current contents of TCSR0 */ + reg = readl(watchdog_base-twcsr0); + + /* Clear the watchdog WDS bit */ + if (reg (XWT_CSR0_EWDT1_MASK | XWT_CSRX_EWDT2_MASK)) + writel(reg | XWT_CSR0_WDS_MASK, watchdog_base-twcsr0); +} +
[U-Boot] [PATCH 3/4] microblaze: Disable all cpu features before reset
From: Michal Simek mon...@monstr.eu Fix microblaze soft reset function and disable all cpu features. Especially disable caches because IRQs were off by disable_interrupts(). Reported-by: John Williams john.willi...@xilinx.com Signed-off-by: Michal Simek mon...@monstr.eu Signed-off-by: Michal Simek michal.si...@xilinx.com --- board/xilinx/microblaze-generic/microblaze-generic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c index 8ba99f9..1af0b86 100644 --- a/board/xilinx/microblaze-generic/microblaze-generic.c +++ b/board/xilinx/microblaze-generic/microblaze-generic.c @@ -40,7 +40,8 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #endif puts (Reseting board\n); - asm (bra r0); + __asm__ __volatile__ ( mts rmsr, r0; \ + bra r0); return 0; } -- 1.8.2.1 pgpr1uMRDPLyj.pgp Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 01/14] arm: zynq: U-Boot udelay 1000 FIX
From: David Andrey david.and...@netmodule.com Rework the __udelay function of U-Boot Zynq Arch to handle delay 1000 usec Signed-off-by: David Andrey david.and...@netmodule.com Signed-off-by: Michal Simek michal.si...@xilinx.com --- arch/arm/cpu/armv7/zynq/timer.c | 46 + 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/arch/arm/cpu/armv7/zynq/timer.c b/arch/arm/cpu/armv7/zynq/timer.c index 45b405a..5d8bb24 100644 --- a/arch/arm/cpu/armv7/zynq/timer.c +++ b/arch/arm/cpu/armv7/zynq/timer.c @@ -114,15 +114,43 @@ ulong get_timer_masked(void) void __udelay(unsigned long usec) { - unsigned long long tmp; - ulong tmo; - - tmo = usec / (100 / CONFIG_SYS_HZ); - tmp = get_ticks() + tmo; /* Get current timestamp */ - - while (get_ticks() tmp) { /* Loop till event */ -/* NOP */; - } + u32 countticks; + u32 timeend; + u32 timediff; + u32 timenow; + + if (usec == 0) + return; + + countticks = (u32) (((unsigned long long) TIMER_TICK_HZ * usec) / + 100); + + /* decrementing timer */ + timeend = readl(timer_base-counter) - countticks; + +#if TIMER_LOAD_VAL != 0x + /* do not manage multiple overflow */ + if (countticks = TIMER_LOAD_VAL) + countticks = TIMER_LOAD_VAL - 1; +#endif + + do { + timenow = readl(timer_base-counter); + + if (timenow = timeend) { + /* normal case */ + timediff = timenow - timeend; + } else { + if ((TIMER_LOAD_VAL - timeend + timenow) = + countticks) { + /* overflow */ + timediff = TIMER_LOAD_VAL - timeend + timenow; + } else { + /* missed the exact match */ + break; + } + } + } while (timediff 0); } /* Timer without interrupts */ -- 1.8.2.1 pgp8xNqcelA3c.pgp Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Xilinx Zynq patches
Hi, I am sending several patches which improve Xilinx Zynq arm port in u-boot. Patchset contain: - core changes: patches 1,2 - gem update: patches 1-11 - mmc support: patch 12 - i2c support: patch 13 - pl support: patch 14 I am sending them in one package because driver depends on each other in zynq shared files. Thanks for your comments, Michal pgpMi43zXCtfF.pgp Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 02/14] zynq: Move scutimer baseaddr to hardware.h
Move baseaddr to hardware.h to be shared between configurations. Signed-off-by: Michal Simek michal.si...@xilinx.com --- arch/arm/cpu/armv7/zynq/timer.c | 1 + arch/arm/include/asm/arch-zynq/hardware.h | 1 + include/configs/zynq.h| 3 --- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm/cpu/armv7/zynq/timer.c b/arch/arm/cpu/armv7/zynq/timer.c index 5d8bb24..44a5f4c 100644 --- a/arch/arm/cpu/armv7/zynq/timer.c +++ b/arch/arm/cpu/armv7/zynq/timer.c @@ -44,6 +44,7 @@ #include common.h #include div64.h #include asm/io.h +#include asm/arch/hardware.h DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/arm/include/asm/arch-zynq/hardware.h b/arch/arm/include/asm/arch-zynq/hardware.h index d0c69da..1b72773 100644 --- a/arch/arm/include/asm/arch-zynq/hardware.h +++ b/arch/arm/include/asm/arch-zynq/hardware.h @@ -26,6 +26,7 @@ #define XPSS_SYS_CTRL_BASEADDR 0xF800 #define XPSS_DEV_CFG_APB_BASEADDR 0xF8007000 #define XPSS_SCU_BASEADDR 0xF8F0 +#define CONFIG_SCUTIMER_BASEADDR 0xF8F00600 /* Reflect slcr offsets */ struct slcr_regs { diff --git a/include/configs/zynq.h b/include/configs/zynq.h index 2989e72..1147689 100644 --- a/include/configs/zynq.h +++ b/include/configs/zynq.h @@ -50,9 +50,6 @@ #define CONFIG_ZYNQ_SERIAL_BAUDRATE0 CONFIG_BAUDRATE #define CONFIG_ZYNQ_SERIAL_CLOCK0 5000 -/* SCU timer address is hardcoded */ -#define CONFIG_SCUTIMER_BASEADDR 0xF8F00600 - /* Ethernet driver */ #define CONFIG_NET_MULTI #define CONFIG_ZYNQ_GEM -- 1.8.2.1 pgpZVAEsUDkNl.pgp Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 03/14] net: phy: Define Marvell 88e1518 phy
From: Michal Simek mon...@monstr.eu This phy is used on zedboard (xilinx zynq platform). Signed-off-by: Michal Simek mon...@monstr.eu Signed-off-by: Michal Simek michal.si...@xilinx.com --- drivers/net/phy/marvell.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 4b27198..46801c7 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -465,6 +465,16 @@ static struct phy_driver M88E1149S_driver = { .shutdown = genphy_shutdown, }; +static struct phy_driver M88E1518_driver = { + .name = Marvell 88E1518, + .uid = 0x1410dd1, + .mask = 0xff0, + .features = PHY_GBIT_FEATURES, + .config = m88es_config, + .startup = m88e1011s_startup, + .shutdown = genphy_shutdown, +}; + int phy_marvell_init(void) { phy_register(M88E1149S_driver); @@ -474,6 +484,7 @@ int phy_marvell_init(void) phy_register(M88E1118R_driver); phy_register(M88ES_driver); phy_register(M88E1011S_driver); + phy_register(M88E1518_driver); return 0; } -- 1.8.2.1 pgprpDcC7l7m6.pgp Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 05/14] net: gem: Simplify return path in zynq_gem_recv
Remove one return from the code. Signed-off-by: Michal Simek michal.si...@xilinx.com --- drivers/net/zynq_gem.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index 7188b9e..c0da628 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -363,11 +363,9 @@ static int zynq_gem_recv(struct eth_device *dev) if ((++priv-rxbd_current) = RX_BUF) priv-rxbd_current = 0; - - return frame_len; } - return 0; + return frame_len; } static void zynq_gem_halt(struct eth_device *dev) -- 1.8.2.1 pgpHQWsiGY7gX.pgp Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 07/14] net: gem: Fix gem driver on 1Gbps LAN
From: Michal Simek mon...@monstr.eu The whole driver used 100Mbps because of zc702 rev B. Fix problem with not setup proper clock for gem1. This is generic approach for clk setup. Signed-off-by: Michal Simek mon...@monstr.eu Signed-off-by: Michal Simek michal.si...@xilinx.com --- arch/arm/cpu/armv7/zynq/slcr.c | 26 +++ arch/arm/include/asm/arch-zynq/hardware.h | 7 +++- arch/arm/include/asm/arch-zynq/sys_proto.h | 1 + drivers/net/zynq_gem.c | 53 +- 4 files changed, 71 insertions(+), 16 deletions(-) diff --git a/arch/arm/cpu/armv7/zynq/slcr.c b/arch/arm/cpu/armv7/zynq/slcr.c index 788a8fd..5a8674a 100644 --- a/arch/arm/cpu/armv7/zynq/slcr.c +++ b/arch/arm/cpu/armv7/zynq/slcr.c @@ -61,3 +61,29 @@ void zynq_slcr_cpu_reset(void) writel(1, slcr_base-pss_rst_ctrl); } + +/* Setup clk for network */ +void zynq_slcr_gem_clk_setup(u32 gem_id, u32 rclk, u32 clk) +{ + zynq_slcr_unlock(); + + if (gem_id 1) { + printf(Non existing GEM id %d\n, gem_id); + goto out; + } + + if (gem_id) { + /* Set divisors for appropriate frequency in GEM_CLK_CTRL */ + writel(clk, slcr_base-gem1_clk_ctrl); + /* Configure GEM_RCLK_CTRL */ + writel(rclk, slcr_base-gem1_rclk_ctrl); + } else { + /* Set divisors for appropriate frequency in GEM_CLK_CTRL */ + writel(clk, slcr_base-gem0_clk_ctrl); + /* Configure GEM_RCLK_CTRL */ + writel(rclk, slcr_base-gem0_rclk_ctrl); + } + +out: + zynq_slcr_lock(); +} diff --git a/arch/arm/include/asm/arch-zynq/hardware.h b/arch/arm/include/asm/arch-zynq/hardware.h index 1b72773..bee7b09 100644 --- a/arch/arm/include/asm/arch-zynq/hardware.h +++ b/arch/arm/include/asm/arch-zynq/hardware.h @@ -33,7 +33,12 @@ struct slcr_regs { u32 scl; /* 0x0 */ u32 slcr_lock; /* 0x4 */ u32 slcr_unlock; /* 0x8 */ - u32 reserved1[125]; + u32 reserved0[75]; + u32 gem0_rclk_ctrl; /* 0x138 */ + u32 gem1_rclk_ctrl; /* 0x13c */ + u32 gem0_clk_ctrl; /* 0x140 */ + u32 gem1_clk_ctrl; /* 0x144 */ + u32 reserved1[46]; u32 pss_rst_ctrl; /* 0x200 */ u32 reserved2[15]; u32 fpga_rst_ctrl; /* 0x240 */ diff --git a/arch/arm/include/asm/arch-zynq/sys_proto.h b/arch/arm/include/asm/arch-zynq/sys_proto.h index e788900..57128dc 100644 --- a/arch/arm/include/asm/arch-zynq/sys_proto.h +++ b/arch/arm/include/asm/arch-zynq/sys_proto.h @@ -26,5 +26,6 @@ extern void zynq_slcr_lock(void); extern void zynq_slcr_unlock(void); extern void zynq_slcr_cpu_reset(void); +extern void zynq_slcr_gem_clk_setup(u32 gem_id, u32 rclk, u32 clk); #endif /* _SYS_PROTO_H_ */ diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index 7758cf8..2d717e9 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -33,6 +33,7 @@ #include phy.h #include miiphy.h #include watchdog.h +#include asm/arch/sys_proto.h #if !defined(CONFIG_PHYLIB) # error XILINX_GEM_ETHERNET requires PHYLIB @@ -67,13 +68,14 @@ #define ZYNQ_GEM_NWCTRL_MDEN_MASK 0x0010 /* Enable MDIO port */ #define ZYNQ_GEM_NWCTRL_STARTTX_MASK 0x0200 /* Start tx (tx_go) */ -#define ZYNQ_GEM_NWCFG_SPEED 0x0001 /* 100 Mbps operation */ -#define ZYNQ_GEM_NWCFG_FDEN0x0002 /* Full Duplex mode */ -#define ZYNQ_GEM_NWCFG_FSREM 0x0002 /* FCS removal */ +#define ZYNQ_GEM_NWCFG_SPEED1000x1 /* 100 Mbps operation */ +#define ZYNQ_GEM_NWCFG_SPEED1000 0x00400 /* 1Gbps operation */ +#define ZYNQ_GEM_NWCFG_FDEN0x2 /* Full Duplex mode */ +#define ZYNQ_GEM_NWCFG_FSREM 0x2 /* FCS removal */ #define ZYNQ_GEM_NWCFG_MDCCLKDIV 0x8 /* Div pclk by 32, 80MHz */ +#define ZYNQ_GEM_NWCFG_MDCCLKDIV2 0xc /* Div pclk by 48, 120MHz */ -#define ZYNQ_GEM_NWCFG_INIT(ZYNQ_GEM_NWCFG_SPEED | \ - ZYNQ_GEM_NWCFG_FDEN | \ +#define ZYNQ_GEM_NWCFG_INIT(ZYNQ_GEM_NWCFG_FDEN | \ ZYNQ_GEM_NWCFG_FSREM | \ ZYNQ_GEM_NWCFG_MDCCLKDIV) @@ -227,7 +229,7 @@ static int zynq_gem_setup_mac(struct eth_device *dev) static int zynq_gem_init(struct eth_device *dev, bd_t * bis) { - u32 i; + u32 i, rclk, clk = 0; struct phy_device *phydev; const u32 stat_size = (sizeof(struct zynq_gem_regs) - offsetof(struct zynq_gem_regs, stat)) / 4; @@ -277,16 +279,11 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis) /* Write RxBDs to IP */ writel((u32)(priv-rx_bd), regs-rxqbase); - /* MAC Setup */ - /* Setup Network Configuration register */ -
[U-Boot] [PATCH 06/14] net: gem: Do not initialize BDs again
BDs can be correctly setup just once and init function performs only phy autodetection and enabling RX/TX. RX/TX are disabled in halt function. This patch solves the problem with repeatable tftp transfers. Signed-off-by: Michal Simek michal.si...@xilinx.com --- drivers/net/zynq_gem.c | 86 +++--- 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index c0da628..7758cf8 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -134,6 +134,7 @@ struct zynq_gem_priv { u32 rxbd_current; u32 rx_first_buf; int phyaddr; + int init; struct phy_device *phydev; struct mii_dev *bus; }; @@ -239,50 +240,57 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis) SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full; - /* Disable all interrupts */ - writel(0x, regs-idr); - - /* Disable the receiver transmitter */ - writel(0, regs-nwctrl); - writel(0, regs-txsr); - writel(0, regs-rxsr); - writel(0, regs-phymntnc); - - /* Clear the Hash registers for the mac address pointed by AddressPtr */ - writel(0x0, regs-hashl); - /* Write bits [63:32] in TOP */ - writel(0x0, regs-hashh); - - /* Clear all counters */ - for (i = 0; i = stat_size; i++) - readl(regs-stat[i]); - - /* Setup RxBD space */ - memset((priv-rx_bd), 0, sizeof(priv-rx_bd)); - /* Create the RxBD ring */ - memset((priv-rxbuffers), 0, sizeof(priv-rxbuffers)); - - for (i = 0; i RX_BUF; i++) { - priv-rx_bd[i].status = 0xF000; - priv-rx_bd[i].addr = (u32)((char *) (priv-rxbuffers) + + if (!priv-init) { + /* Disable all interrupts */ + writel(0x, regs-idr); + + /* Disable the receiver transmitter */ + writel(0, regs-nwctrl); + writel(0, regs-txsr); + writel(0, regs-rxsr); + writel(0, regs-phymntnc); + + /* Clear the Hash registers for the mac address +* pointed by AddressPtr +*/ + writel(0x0, regs-hashl); + /* Write bits [63:32] in TOP */ + writel(0x0, regs-hashh); + + /* Clear all counters */ + for (i = 0; i = stat_size; i++) + readl(regs-stat[i]); + + /* Setup RxBD space */ + memset((priv-rx_bd), 0, sizeof(priv-rx_bd)); + /* Create the RxBD ring */ + memset((priv-rxbuffers), 0, sizeof(priv-rxbuffers)); + + for (i = 0; i RX_BUF; i++) { + priv-rx_bd[i].status = 0xF000; + priv-rx_bd[i].addr = + (u32)((char *)(priv-rxbuffers) + (i * PKTSIZE_ALIGN)); - } - /* WRAP bit to last BD */ - priv-rx_bd[--i].addr |= ZYNQ_GEM_RXBUF_WRAP_MASK; - /* Write RxBDs to IP */ - writel((u32) (priv-rx_bd), regs-rxqbase); + } + /* WRAP bit to last BD */ + priv-rx_bd[--i].addr |= ZYNQ_GEM_RXBUF_WRAP_MASK; + /* Write RxBDs to IP */ + writel((u32)(priv-rx_bd), regs-rxqbase); - /* MAC Setup */ - /* Setup Network Configuration register */ - writel(ZYNQ_GEM_NWCFG_INIT, regs-nwcfg); + /* MAC Setup */ + /* Setup Network Configuration register */ + writel(ZYNQ_GEM_NWCFG_INIT, regs-nwcfg); - /* Setup for DMA Configuration register */ - writel(ZYNQ_GEM_DMACR_INIT, regs-dmacr); + /* Setup for DMA Configuration register */ + writel(ZYNQ_GEM_DMACR_INIT, regs-dmacr); - /* Setup for Network Control register, MDIO, Rx and Tx enable */ - setbits_le32(regs-nwctrl, ZYNQ_GEM_NWCTRL_MDEN_MASK | + /* Setup for Network Control register, MDIO, Rx and Tx enable */ + setbits_le32(regs-nwctrl, ZYNQ_GEM_NWCTRL_MDEN_MASK | ZYNQ_GEM_NWCTRL_RXEN_MASK | ZYNQ_GEM_NWCTRL_TXEN_MASK); + priv-init++; + } + /* interface - look at tsec */ phydev = phy_connect(priv-bus, priv-phyaddr, dev, 0); @@ -307,7 +315,7 @@ static int zynq_gem_send(struct eth_device *dev, void *ptr, int len) writel((u32)(priv-tx_bd), regs-txqbase); /* Setup Tx BD */ - memset((void *) (priv-tx_bd), 0, sizeof(struct emac_bd)); + memset((void *)(priv-tx_bd), 0, sizeof(struct emac_bd)); priv-tx_bd.addr = (u32)ptr; priv-tx_bd.status = len | ZYNQ_GEM_TXBUF_LAST_MASK; -- 1.8.2.1 pgpl1zaghcHOG.pgp Description: PGP signature ___ U-Boot mailing
[U-Boot] [PATCH 09/14] net: gem: Pass phy address to init
From: David Andrey david.and...@netmodule.com Pass the PHY address to the driver init to allow parallel use of both interfaces Signed-off-by: David Andrey david.and...@netmodule.com Signed-off-by: Michal Simek michal.si...@xilinx.com --- board/xilinx/zynq/board.c | 6 -- drivers/net/zynq_gem.c| 8 ++-- include/configs/zynq.h| 1 + include/netdev.h | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 8da476c..f92d5a8 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -42,10 +42,12 @@ int board_eth_init(bd_t *bis) #if defined(CONFIG_ZYNQ_GEM) # if defined(CONFIG_ZYNQ_GEM0) - ret |= zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR0); + ret |= zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR0, + CONFIG_ZYNQ_GEM_PHY_ADDR0); # endif # if defined(CONFIG_ZYNQ_GEM1) - ret |= zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR1); + ret |= zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR1, + CONFIG_ZYNQ_GEM_PHY_ADDR1); # endif #endif return ret; diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index 2d717e9..316816d 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -427,7 +427,7 @@ static int zynq_gem_miiphy_write(const char *devname, uchar addr, return phywrite(dev, addr, reg, val); } -int zynq_gem_initialize(bd_t *bis, int base_addr) +int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr) { struct eth_device *dev; struct zynq_gem_priv *priv; @@ -443,11 +443,7 @@ int zynq_gem_initialize(bd_t *bis, int base_addr) } priv = dev-priv; -#ifdef CONFIG_PHY_ADDR - priv-phyaddr = CONFIG_PHY_ADDR; -#else - priv-phyaddr = -1; -#endif + priv-phyaddr = phy_addr; sprintf(dev-name, Gem.%x, base_addr); diff --git a/include/configs/zynq.h b/include/configs/zynq.h index ebe1b1b..3b23354 100644 --- a/include/configs/zynq.h +++ b/include/configs/zynq.h @@ -54,6 +54,7 @@ #define CONFIG_NET_MULTI #define CONFIG_ZYNQ_GEM #define CONFIG_ZYNQ_GEM0 +#define CONFIG_ZYNQ_GEM_PHY_ADDR0 7 #if defined(CONFIG_ZYNQ_DCC) # define CONFIG_ARM_DCC diff --git a/include/netdev.h b/include/netdev.h index fd3e243..81117b1 100644 --- a/include/netdev.h +++ b/include/netdev.h @@ -104,7 +104,7 @@ int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr, int txpp, int rxpp); int xilinx_ll_temac_eth_init(bd_t *bis, unsigned long base_addr, int flags, unsigned long ctrl_addr); -int zynq_gem_initialize(bd_t *bis, int base_addr); +int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr); /* * As long as the Xilinx xps_ll_temac ethernet driver has not its own interface * exported by a public hader file, we need a global definition at this point. -- 1.8.2.1 pgp1Ox4NfMI50.pgp Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 08/14] zynq: Move macros to hardware.h
Add all fixed addresses to hardware.h and change petalinux configuration to support this. Signed-off-by: Michal Simek michal.si...@xilinx.com --- arch/arm/include/asm/arch-zynq/hardware.h | 2 ++ board/xilinx/zynq/board.c | 12 +--- include/configs/zynq.h| 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/arch-zynq/hardware.h b/arch/arm/include/asm/arch-zynq/hardware.h index bee7b09..e0f6eba 100644 --- a/arch/arm/include/asm/arch-zynq/hardware.h +++ b/arch/arm/include/asm/arch-zynq/hardware.h @@ -27,6 +27,8 @@ #define XPSS_DEV_CFG_APB_BASEADDR 0xF8007000 #define XPSS_SCU_BASEADDR 0xF8F0 #define CONFIG_SCUTIMER_BASEADDR 0xF8F00600 +#define CONFIG_ZYNQ_GEM_BASEADDR0 0xE000B000 +#define CONFIG_ZYNQ_GEM_BASEADDR1 0xE000C000 /* Reflect slcr offsets */ struct slcr_regs { diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 8ed75c3..8da476c 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -22,6 +22,8 @@ #include common.h #include netdev.h +#include asm/arch/hardware.h +#include asm/arch/sys_proto.h DECLARE_GLOBAL_DATA_PTR; @@ -38,10 +40,14 @@ int board_eth_init(bd_t *bis) { u32 ret = 0; -#if defined(CONFIG_ZYNQ_GEM) defined(CONFIG_ZYNQ_GEM_BASEADDR0) - ret = zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR0); +#if defined(CONFIG_ZYNQ_GEM) +# if defined(CONFIG_ZYNQ_GEM0) + ret |= zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR0); +# endif +# if defined(CONFIG_ZYNQ_GEM1) + ret |= zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR1); +# endif #endif - return ret; } #endif diff --git a/include/configs/zynq.h b/include/configs/zynq.h index 1147689..ebe1b1b 100644 --- a/include/configs/zynq.h +++ b/include/configs/zynq.h @@ -53,7 +53,7 @@ /* Ethernet driver */ #define CONFIG_NET_MULTI #define CONFIG_ZYNQ_GEM -#define CONFIG_ZYNQ_GEM_BASEADDR0 0xE000B000 +#define CONFIG_ZYNQ_GEM0 #if defined(CONFIG_ZYNQ_DCC) # define CONFIG_ARM_DCC -- 1.8.2.1 pgpGXtNEC3nVU.pgp Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 10/14] net: gem: Preserve clk on emio interface
From: David Andrey david.and...@netmodule.com Avoid overwriting GEMx_RCLK_CTRL and GEMx_CLK_CTRL if the Ethernet interface is connect on EMIO Do not enable emio for this standard board configuration for now. Signed-off-by: David Andrey david.and...@netmodule.com Signed-off-by: Michal Simek michal.si...@xilinx.com --- board/xilinx/zynq/board.c | 4 ++-- drivers/net/zynq_gem.c| 12 +--- include/netdev.h | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index f92d5a8..574a6fb 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -43,11 +43,11 @@ int board_eth_init(bd_t *bis) #if defined(CONFIG_ZYNQ_GEM) # if defined(CONFIG_ZYNQ_GEM0) ret |= zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR0, - CONFIG_ZYNQ_GEM_PHY_ADDR0); + CONFIG_ZYNQ_GEM_PHY_ADDR0, 0); # endif # if defined(CONFIG_ZYNQ_GEM1) ret |= zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR1, - CONFIG_ZYNQ_GEM_PHY_ADDR1); + CONFIG_ZYNQ_GEM_PHY_ADDR1, 0); # endif #endif return ret; diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index 316816d..ee3ff73 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -33,6 +33,7 @@ #include phy.h #include miiphy.h #include watchdog.h +#include asm/arch/hardware.h #include asm/arch/sys_proto.h #if !defined(CONFIG_PHYLIB) @@ -136,6 +137,7 @@ struct zynq_gem_priv { u32 rxbd_current; u32 rx_first_buf; int phyaddr; + u32 emio; int init; struct phy_device *phydev; struct mii_dev *bus; @@ -317,8 +319,11 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis) clk = (5 20) | (8 8) | (0 4) | (1 0); break; } - /* FIXME maybe better to define gem address in hardware.h */ - zynq_slcr_gem_clk_setup(dev-iobase != 0xE000B000, rclk, clk); + + /* Change the rclk and clk only not using EMIO interface */ + if (!priv-emio) + zynq_slcr_gem_clk_setup(dev-iobase != + CONFIG_ZYNQ_GEM_BASEADDR0, rclk, clk); setbits_le32(regs-nwctrl, ZYNQ_GEM_NWCTRL_RXEN_MASK | ZYNQ_GEM_NWCTRL_TXEN_MASK); @@ -427,7 +432,7 @@ static int zynq_gem_miiphy_write(const char *devname, uchar addr, return phywrite(dev, addr, reg, val); } -int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr) +int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr, u32 emio) { struct eth_device *dev; struct zynq_gem_priv *priv; @@ -444,6 +449,7 @@ int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr) priv = dev-priv; priv-phyaddr = phy_addr; + priv-emio = emio; sprintf(dev-name, Gem.%x, base_addr); diff --git a/include/netdev.h b/include/netdev.h index 81117b1..516b351 100644 --- a/include/netdev.h +++ b/include/netdev.h @@ -104,7 +104,7 @@ int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr, int txpp, int rxpp); int xilinx_ll_temac_eth_init(bd_t *bis, unsigned long base_addr, int flags, unsigned long ctrl_addr); -int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr); +int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr, u32 emio); /* * As long as the Xilinx xps_ll_temac ethernet driver has not its own interface * exported by a public hader file, we need a global definition at this point. -- 1.8.2.1 pgpc3s7rev098.pgp Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 11/14] net: gem: Add support for phy autodetection
Autodetect phy if phyaddress is setup to -1. Signed-off-by: Michal Simek michal.si...@xilinx.com --- drivers/net/zynq_gem.c | 51 ++ 1 file changed, 51 insertions(+) diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index ee3ff73..c4d0de4 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -95,6 +95,17 @@ ZYNQ_GEM_DMACR_TXSIZE | \ ZYNQ_GEM_DMACR_RXBUF) +/* Use MII register 1 (MII status register) to detect PHY */ +#define PHY_DETECT_REG 1 + +/* Mask used to verify certain PHY features (or register contents) + * in the register above: + * 0x1000: 10Mbps full duplex support + * 0x0800: 10Mbps half duplex support + * 0x0008: Auto-negotiation support + */ +#define PHY_DETECT_MASK 0x1808 + /* Device registers */ struct zynq_gem_regs { u32 nwctrl; /* Network Control reg */ @@ -201,6 +212,44 @@ static u32 phywrite(struct eth_device *dev, u32 phy_addr, u32 regnum, u16 data) ZYNQ_GEM_PHYMNTNC_OP_W_MASK, data); } +static void phy_detection(struct eth_device *dev) +{ + int i; + u16 phyreg; + struct zynq_gem_priv *priv = dev-priv; + + if (priv-phyaddr != -1) { + phyread(dev, priv-phyaddr, PHY_DETECT_REG, phyreg); + if ((phyreg != 0x) + ((phyreg PHY_DETECT_MASK) == PHY_DETECT_MASK)) { + /* Found a valid PHY address */ + debug(Default phy address %d is valid\n, + priv-phyaddr); + return; + } else { + debug(PHY address is not setup correctly %d\n, + priv-phyaddr); + priv-phyaddr = -1; + } + } + + debug(detecting phy address\n); + if (priv-phyaddr == -1) { + /* detect the PHY address */ + for (i = 31; i = 0; i--) { + phyread(dev, i, PHY_DETECT_REG, phyreg); + if ((phyreg != 0x) + ((phyreg PHY_DETECT_MASK) == PHY_DETECT_MASK)) { + /* Found a valid PHY address */ + priv-phyaddr = i; + debug(Found valid phy address, %d\n, i); + return; + } + } + } + printf(PHY is not detected\n); +} + static int zynq_gem_setup_mac(struct eth_device *dev) { u32 i, macaddrlow, macaddrhigh; @@ -290,6 +339,8 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis) priv-init++; } + phy_detection(dev); + /* interface - look at tsec */ phydev = phy_connect(priv-bus, priv-phyaddr, dev, 0); -- 1.8.2.1 pgpOvF3qkZikM.pgp Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 12/14] mmc: Add support for Xilinx Zynq sdhci controller
Add support for SD, MMC and eMMC card on Xilinx Zynq. Signed-off-by: Michal Simek michal.si...@xilinx.com --- arch/arm/include/asm/arch-zynq/hardware.h | 2 ++ arch/arm/include/asm/arch-zynq/sys_proto.h | 3 +++ board/xilinx/zynq/board.c | 17 + drivers/mmc/Makefile | 1 + drivers/mmc/zynq_sdhci.c | 40 ++ include/configs/zynq.h | 16 6 files changed, 79 insertions(+) create mode 100644 drivers/mmc/zynq_sdhci.c diff --git a/arch/arm/include/asm/arch-zynq/hardware.h b/arch/arm/include/asm/arch-zynq/hardware.h index e0f6eba..3fa94d7 100644 --- a/arch/arm/include/asm/arch-zynq/hardware.h +++ b/arch/arm/include/asm/arch-zynq/hardware.h @@ -29,6 +29,8 @@ #define CONFIG_SCUTIMER_BASEADDR 0xF8F00600 #define CONFIG_ZYNQ_GEM_BASEADDR0 0xE000B000 #define CONFIG_ZYNQ_GEM_BASEADDR1 0xE000C000 +#define CONFIG_ZYNQ_SDHCI_BASEADDR00xE010 +#define CONFIG_ZYNQ_SDHCI_BASEADDR10xE0101000 /* Reflect slcr offsets */ struct slcr_regs { diff --git a/arch/arm/include/asm/arch-zynq/sys_proto.h b/arch/arm/include/asm/arch-zynq/sys_proto.h index 57128dc..af9e7f8 100644 --- a/arch/arm/include/asm/arch-zynq/sys_proto.h +++ b/arch/arm/include/asm/arch-zynq/sys_proto.h @@ -28,4 +28,7 @@ extern void zynq_slcr_unlock(void); extern void zynq_slcr_cpu_reset(void); extern void zynq_slcr_gem_clk_setup(u32 gem_id, u32 rclk, u32 clk); +/* Driver extern functions */ +extern int zynq_sdhci_init(u32 regbase); + #endif /* _SYS_PROTO_H_ */ diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 574a6fb..e42febd 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -54,6 +54,23 @@ int board_eth_init(bd_t *bis) } #endif +#ifdef CONFIG_CMD_MMC +int board_mmc_init(bd_t *bd) +{ + int ret = 0; + +#if defined(CONFIG_ZYNQ_SDHCI) +# if defined(CONFIG_ZYNQ_SDHCI0) + ret = zynq_sdhci_init(CONFIG_ZYNQ_SDHCI_BASEADDR0); +# endif +# if defined(CONFIG_ZYNQ_SDHCI1) + ret |= zynq_sdhci_init(CONFIG_ZYNQ_SDHCI_BASEADDR1); +# endif +#endif + return ret; +} +#endif + int dram_init(void) { gd-ram_size = CONFIG_SYS_SDRAM_SIZE; diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile index 1d6faa2..7cd4281 100644 --- a/drivers/mmc/Makefile +++ b/drivers/mmc/Makefile @@ -49,6 +49,7 @@ COBJS-$(CONFIG_SH_MMCIF) += sh_mmcif.o COBJS-$(CONFIG_TEGRA_MMC) += tegra_mmc.o COBJS-$(CONFIG_DWMMC) += dw_mmc.o COBJS-$(CONFIG_EXYNOS_DWMMC) += exynos_dw_mmc.o +COBJS-$(CONFIG_ZYNQ_SDHCI) += zynq_sdhci.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c new file mode 100644 index 000..9e37af4 --- /dev/null +++ b/drivers/mmc/zynq_sdhci.c @@ -0,0 +1,40 @@ +/* + * (C) Copyright 2013 Inc. + * + * Xilinx Zynq SD Host Controller Interface + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include common.h +#include malloc.h +#include sdhci.h +#include asm/arch/sys_proto.h + +int zynq_sdhci_init(u32 regbase) +{ + struct sdhci_host *host = NULL; + + host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host)); + if (!host) { + printf(zynq_sdhci_init: sdhci_host malloc fail\n); + return 1; + } + + host-name = zynq_sdhci; + host-ioaddr = (void *)regbase; + host-quirks = SDHCI_QUIRK_NO_CD | SDHCI_QUIRK_WAIT_SEND_CMD; + host-version = sdhci_readw(host, SDHCI_HOST_VERSION); + + host-host_caps = MMC_MODE_HC; + + add_sdhci(host, 5200, 5200 9); + return 0; +} diff --git a/include/configs/zynq.h b/include/configs/zynq.h index 3b23354..2ed88a7 100644 --- a/include/configs/zynq.h +++ b/include/configs/zynq.h @@ -56,6 +56,22 @@ #define CONFIG_ZYNQ_GEM0 #define CONFIG_ZYNQ_GEM_PHY_ADDR0 7 +#define CONFIG_ZYNQ_SDHCI +#define CONFIG_ZYNQ_SDHCI0 + +/* MMC */ +#if defined(CONFIG_ZYNQ_SDHCI0) || defined(CONFIG_ZYNQ_SDHCI1) +# define CONFIG_MMC +# define CONFIG_GENERIC_MMC +# 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_DOS_PARTITION +#endif + #if defined(CONFIG_ZYNQ_DCC) # define CONFIG_ARM_DCC # define CONFIG_CPU_V6 /* Required by CONFIG_ARM_DCC */ -- 1.8.2.1 pgpff2iU91i4X.pgp Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de
[U-Boot] [PATCH 13/14] i2c: zynq: Add support for Xilinx Zynq
Support Xilinx Zynq i2c controller. Signed-off-by: Joe Hershberger joe.hershber...@ni.com Signed-off-by: Michal Simek michal.si...@xilinx.com --- arch/arm/include/asm/arch-zynq/hardware.h | 2 + drivers/i2c/Makefile | 1 + drivers/i2c/zynq_i2c.c| 304 ++ include/configs/zynq.h| 11 ++ 4 files changed, 318 insertions(+) create mode 100644 drivers/i2c/zynq_i2c.c diff --git a/arch/arm/include/asm/arch-zynq/hardware.h b/arch/arm/include/asm/arch-zynq/hardware.h index 3fa94d7..901a74c 100644 --- a/arch/arm/include/asm/arch-zynq/hardware.h +++ b/arch/arm/include/asm/arch-zynq/hardware.h @@ -31,6 +31,8 @@ #define CONFIG_ZYNQ_GEM_BASEADDR1 0xE000C000 #define CONFIG_ZYNQ_SDHCI_BASEADDR00xE010 #define CONFIG_ZYNQ_SDHCI_BASEADDR10xE0101000 +#define CONFIG_ZYNQ_I2C_BASEADDR0 0xE0004000 +#define CONFIG_ZYNQ_I2C_BASEADDR1 0xE0005000 /* Reflect slcr offsets */ struct slcr_regs { diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index 5dbdbe3..72e85a3 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -46,6 +46,7 @@ COBJS-$(CONFIG_TSI108_I2C) += tsi108_i2c.o COBJS-$(CONFIG_U8500_I2C) += u8500_i2c.o COBJS-$(CONFIG_SH_I2C) += sh_i2c.o COBJS-$(CONFIG_SH_SH7734_I2C) += sh_sh7734_i2c.o +COBJS-$(CONFIG_ZYNQ_I2C) += zynq_i2c.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/i2c/zynq_i2c.c b/drivers/i2c/zynq_i2c.c new file mode 100644 index 000..6ccf41f --- /dev/null +++ b/drivers/i2c/zynq_i2c.c @@ -0,0 +1,304 @@ +/* + * Driver for the Zynq-7000 PS I2C controller + * IP from Cadence (ID T-CS-PE-0007-100, Version R1p10f2) + * + * Author: Joe Hershberger joe.hershber...@ni.com + * Copyright (c) 2012 Joe Hershberger. + * + * Copyright (c) 2012-2013 Xilinx, Michal Simek + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include common.h +#include asm/io.h +#include i2c.h +#include asm/errno.h +#include asm/arch/hardware.h + +/* i2c register set */ +struct zynq_i2c_registers { + u32 control; + u32 status; + u32 address; + u32 data; + u32 interrupt_status; + u32 transfer_size; + u32 slave_mon_pause; + u32 time_out; + u32 interrupt_mask; + u32 interrupt_enable; + u32 interrupt_disable; +}; + +/* Control register fields */ +#defineZYNQ_I2C_CONTROL_RW 0x0001 +#defineZYNQ_I2C_CONTROL_MS 0x0002 +#defineZYNQ_I2C_CONTROL_NEA0x0004 +#defineZYNQ_I2C_CONTROL_ACKEN 0x0008 +#defineZYNQ_I2C_CONTROL_HOLD 0x0010 +#defineZYNQ_I2C_CONTROL_SLVMON 0x0020 +#defineZYNQ_I2C_CONTROL_CLR_FIFO 0x0040 +#defineZYNQ_I2C_CONTROL_DIV_B_SHIFT8 +#defineZYNQ_I2C_CONTROL_DIV_B_MASK 0x3F00 +#defineZYNQ_I2C_CONTROL_DIV_A_SHIFT14 +#defineZYNQ_I2C_CONTROL_DIV_A_MASK 0xC000 + +/* Status register values */ +#defineZYNQ_I2C_STATUS_RXDV0x0020 +#defineZYNQ_I2C_STATUS_TXDV0x0040 +#defineZYNQ_I2C_STATUS_RXOVF 0x0080 +#defineZYNQ_I2C_STATUS_BA 0x0100 + +/* Interrupt register fields */ +#defineZYNQ_I2C_INTERRUPT_COMP 0x0001 +#defineZYNQ_I2C_INTERRUPT_DATA 0x0002 +#defineZYNQ_I2C_INTERRUPT_NACK 0x0004 +#defineZYNQ_I2C_INTERRUPT_TO 0x0008 +#defineZYNQ_I2C_INTERRUPT_SLVRDY 0x0010 +#defineZYNQ_I2C_INTERRUPT_RXOVF0x0020 +#defineZYNQ_I2C_INTERRUPT_TXOVF0x0040 +#defineZYNQ_I2C_INTERRUPT_RXUNF0x0080 +#defineZYNQ_I2C_INTERRUPT_ARBLOST 0x0200 + +#define ZYNQ_I2C_FIFO_DEPTH16 +#define ZYNQ_I2C_TRANSFERT_SIZE_MAX255 /* Controller transfer limit */ + +#if defined(CONFIG_ZYNQ_I2C0) +# define ZYNQ_I2C_BASE CONFIG_ZYNQ_I2C_BASEADDR0 +#else +# define ZYNQ_I2C_BASE CONFIG_ZYNQ_I2C_BASEADDR1 +#endif + +static struct zynq_i2c_registers *zynq_i2c = + (struct zynq_i2c_registers *) ZYNQ_I2C_BASE; + +/* I2C init called by cmd_i2c when doing
[U-Boot] [PATCH 14/14] fpga: Add support for loading bitstream for Xilinx Zynq
Devcfg device requires to load bitstream in binary format. Signed-off-by: Joe Hershberger joe.hershber...@ni.com Signed-off-by: Michal Simek michal.si...@xilinx.com --- arch/arm/cpu/armv7/zynq/slcr.c | 36 + arch/arm/include/asm/arch-zynq/hardware.h | 10 +- arch/arm/include/asm/arch-zynq/sys_proto.h | 3 + board/xilinx/zynq/board.c | 37 + drivers/fpga/Makefile | 1 + drivers/fpga/xilinx.c | 37 + drivers/fpga/zynqpl.c | 231 + include/configs/zynq.h | 6 + include/xilinx.h | 4 + include/zynqpl.h | 61 10 files changed, 424 insertions(+), 2 deletions(-) create mode 100644 drivers/fpga/zynqpl.c create mode 100644 include/zynqpl.h diff --git a/arch/arm/cpu/armv7/zynq/slcr.c b/arch/arm/cpu/armv7/zynq/slcr.c index 5a8674a..a391af4 100644 --- a/arch/arm/cpu/armv7/zynq/slcr.c +++ b/arch/arm/cpu/armv7/zynq/slcr.c @@ -28,6 +28,9 @@ #define SLCR_LOCK_MAGIC0x767B #define SLCR_UNLOCK_MAGIC 0xDF0D +#define SLCR_IDCODE_MASK 0x1F000 +#define SLCR_IDCODE_SHIFT 12 + static int slcr_lock = 1; /* 1 means locked, 0 means unlocked */ void zynq_slcr_lock(void) @@ -87,3 +90,36 @@ void zynq_slcr_gem_clk_setup(u32 gem_id, u32 rclk, u32 clk) out: zynq_slcr_lock(); } + +void zynq_slcr_devcfg_disable(void) +{ + zynq_slcr_unlock(); + + /* Disable AXI interface */ + writel(0x, slcr_base-fpga_rst_ctrl); + + /* Set Level Shifters DT618760 */ + writel(0xA, slcr_base-lvl_shftr_en); + + zynq_slcr_lock(); +} + +void zynq_slcr_devcfg_enable(void) +{ + zynq_slcr_unlock(); + + /* Set Level Shifters DT618760 */ + writel(0xF, slcr_base-lvl_shftr_en); + + /* Disable AXI interface */ + writel(0x0, slcr_base-fpga_rst_ctrl); + + zynq_slcr_lock(); +} + +u32 zynq_slcr_get_idcode(void) +{ + return (readl(slcr_base-pss_idcode) SLCR_IDCODE_MASK) + SLCR_IDCODE_SHIFT; +} + diff --git a/arch/arm/include/asm/arch-zynq/hardware.h b/arch/arm/include/asm/arch-zynq/hardware.h index 901a74c..93e6894 100644 --- a/arch/arm/include/asm/arch-zynq/hardware.h +++ b/arch/arm/include/asm/arch-zynq/hardware.h @@ -53,11 +53,17 @@ struct slcr_regs { u32 boot_mode; /* 0x25c */ u32 reserved4[116]; u32 trust_zone; /* 0x430 */ /* FIXME */ - u32 reserved5[115]; + u32 reserved5_1[63]; + u32 pss_idcode; /* 0x530 */ + u32 reserved5_2[51]; u32 ddr_urgent; /* 0x600 */ u32 reserved6[6]; u32 ddr_urgent_sel; /* 0x61c */ - u32 reserved7[188]; + u32 reserved7[56]; + u32 mio_pin[54]; /* 0x700 - 0x7D4 */ + u32 reserved8[74]; + u32 lvl_shftr_en; /* 0x900 */ + u32 reserved9[3]; u32 ocm_cfg; /* 0x910 */ }; diff --git a/arch/arm/include/asm/arch-zynq/sys_proto.h b/arch/arm/include/asm/arch-zynq/sys_proto.h index af9e7f8..2317121 100644 --- a/arch/arm/include/asm/arch-zynq/sys_proto.h +++ b/arch/arm/include/asm/arch-zynq/sys_proto.h @@ -27,6 +27,9 @@ extern void zynq_slcr_lock(void); extern void zynq_slcr_unlock(void); extern void zynq_slcr_cpu_reset(void); extern void zynq_slcr_gem_clk_setup(u32 gem_id, u32 rclk, u32 clk); +extern void zynq_slcr_devcfg_disable(void); +extern void zynq_slcr_devcfg_enable(void); +extern u32 zynq_slcr_get_idcode(void); /* Driver extern functions */ extern int zynq_sdhci_init(u32 regbase); diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index e42febd..4bc757a 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -22,15 +22,52 @@ #include common.h #include netdev.h +#include zynqpl.h #include asm/arch/hardware.h #include asm/arch/sys_proto.h DECLARE_GLOBAL_DATA_PTR; +#ifdef CONFIG_FPGA +Xilinx_desc fpga; + +/* It can be done differently */ +Xilinx_desc fpga010 = XILINX_XC7Z010_DESC(0x10); +Xilinx_desc fpga020 = XILINX_XC7Z020_DESC(0x20); +Xilinx_desc fpga030 = XILINX_XC7Z030_DESC(0x30); +Xilinx_desc fpga045 = XILINX_XC7Z045_DESC(0x45); +#endif + int board_init(void) { +#ifdef CONFIG_FPGA + u32 idcode; + + idcode = zynq_slcr_get_idcode(); + + switch (idcode) { + case XILINX_ZYNQ_7010: + fpga = fpga010; + break; + case XILINX_ZYNQ_7020: + fpga = fpga020; + break; + case XILINX_ZYNQ_7030: + fpga = fpga030; + break; + case XILINX_ZYNQ_7045: + fpga = fpga045; + break; + } +#endif + icache_enable(); +#ifdef CONFIG_FPGA + fpga_init(); + fpga_add(fpga_xilinx, fpga); +#endif + return 0; } diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile index b48f623..0b51dcd 100644 ---
[U-Boot] [PATCH 04/14] net: gem: Remove WRAP bit from TX buffer description
From: Michal Simek mon...@monstr.eu Removing this bit causes that frame is sent only once. (With wrap big one packet has been sent several times which dramatically decrease throughput) TRM: (Table 16-3: Tx Buffer Descriptor Entry) Signed-off-by: Michal Simek mon...@monstr.eu Signed-off-by: Michal Simek michal.si...@xilinx.com --- drivers/net/zynq_gem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index 3596065..7188b9e 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -310,8 +310,7 @@ static int zynq_gem_send(struct eth_device *dev, void *ptr, int len) memset((void *) (priv-tx_bd), 0, sizeof(struct emac_bd)); priv-tx_bd.addr = (u32)ptr; - priv-tx_bd.status = len | ZYNQ_GEM_TXBUF_LAST_MASK | - ZYNQ_GEM_TXBUF_WRAP_MASK; + priv-tx_bd.status = len | ZYNQ_GEM_TXBUF_LAST_MASK; /* Start transmit */ setbits_le32(regs-nwctrl, ZYNQ_GEM_NWCTRL_STARTTX_MASK); -- 1.8.2.1 pgpZzOUvkl78S.pgp Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3 0/17] sandbox: Generic board support and other improvements
On Sat, Apr 20, 2013 at 11:42:35AM -0700, Simon Glass wrote: This series adds generic board support to sandbox and switches to use this always. With sandbox it was noticed that turning CONFIG_SYS_GENERIC_BOARD off can cause a build failure if a previous autoconf.mk exists which indicates that generic board is not supported, so a patch is provided to fix this. It is useful to convert a pointer into an 'address' in the sandbox RAM buffer - the opposite of map_sysmem(). This is added in this series and used in several places. With sandbox it is easier to read a file from the host than to use the CONFIG_OF_SEPARATE option, since this option requires knowledge of the executable image structure which is not really appropriate on the host system. A new CONFIG_OF_HOSTFILE provides this. A few related FDT changes are included in this series also. The -c option is enhanced to support passing entire scripts to sandbox. This is useful when writing non-trivial test code. Most of these patches were previously submitted as part of the verified boot effort. This series collects the independent sandbox-related patches together to make it easier to review. THe whole series is marked as version 3 for this reason. For the series, Reviewed-by: Tom Rini tr...@ti.com And I'd say 3/4/5 should be squashed into one patch, but it's your arch so I'l defer if you think it adds bisect value or similar to do it in that manner. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/6] i2c: fsl_i2c:i2c_read(): dont try to write address w/ alen=0
Dirk Eibach eibach at gdsys.de writes: From: Reinhard Pfau pfau at gdsys.de if alen is 0: no longer start a write cycle before reading data. Signed-off-by: Dirk Eibach eibach at gdsys.de Signed-off-by: Reinhard Pfau pfau at gdsys.de This will break my stand alone application, which relies on a zero address len to provide i2c_probe functionality, since i2c_probe is not exported via _exports.h. Is there some other way to do i2c_probe in a stand alone application? Thanks, Jim ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 4/4] watchdog: Add support for Xilinx Microblaze watchdog
On Mon, Apr 22, 2013 at 04:41:03PM +0200, Michal Simek wrote: Watchdog can be used on Microblaze, PPC and Zynq hw designs. [snip] +++ b/drivers/watchdog/xilinx_tb_wdt.c [snip] +#define watchdog_base ((struct watchdog_regs *)CONFIG_WATCHDOG_BASEADDR) Just do: static struct watchdog_regs *watchdog_base = CONFIG_WATCHDOG_BASEADDR; [snip] +/* watchdog */ +#if defined(XILINX_WATCHDOG_BASEADDR) defined(XILINX_WATCHDOG_IRQ) +# define CONFIG_WATCHDOG_BASEADDRXILINX_WATCHDOG_BASEADDR +# define CONFIG_WATCHDOG_IRQ XILINX_WATCHDOG_IRQ +# define CONFIG_HW_WATCHDOG 1 +# define CONFIG_XILINX_TB_WATCHDOG 1 Just '#define' and no 1 for options that we only need to set please, thanks. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/2] da850: provide davinci_enable_uart0
this is needed to bring UART0 out of reset but this function currently only exists for dm644x/355/365/646x when da850 (at least am1808 also need it). Signed-off-by: Eric Bénard e...@eukrea.com --- arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c | 8 arch/arm/include/asm/arch-davinci/hardware.h| 2 ++ 2 files changed, 10 insertions(+) diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c index ff2e2e3..127beb8 100644 --- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c +++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c @@ -32,6 +32,14 @@ #include asm/arch/emif_defs.h #include asm/arch/pll_defs.h +void davinci_enable_uart0(void) +{ + lpsc_on(DAVINCI_LPSC_UART0); + + /* Bringup UART0 out of reset */ + REG(UART0_PWREMU_MGMT) = 0x6001; +} + #if defined(CONFIG_SYS_DA850_PLL_INIT) void da850_waitloop(unsigned long loopcnt) { diff --git a/arch/arm/include/asm/arch-davinci/hardware.h b/arch/arm/include/asm/arch-davinci/hardware.h index 6eed6c9..a9017e4 100644 --- a/arch/arm/include/asm/arch-davinci/hardware.h +++ b/arch/arm/include/asm/arch-davinci/hardware.h @@ -346,6 +346,8 @@ void davinci_errata_workarounds(void); #define PSC_PSC0_MODULE_ID_CNT 16 #define PSC_PSC1_MODULE_ID_CNT 32 +#define UART0_PWREMU_MGMT (0x01c42030) + struct davinci_psc_regs { dv_reg revid; dv_reg rsvd0[71]; -- 1.7.11.7 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/2] davinci: handle CONFIG_SYS_CLE_MASK and CONFIG_SYS_ALE_MASK
these variables are curently defined in several config files but the driver doesn't use them and defaults to hardcoded values in nand_defs.h It's interesting to be able to change this hardcoded valude when the hardware is not using the default adress signals to drive ALE and CLE and two configuration defines already exist for this purpose so use them. Signed-off-by: Eric Bénard e...@eukrea.com --- arch/arm/include/asm/arch-davinci/nand_defs.h | 9 + include/configs/da830evm.h| 4 ++-- include/configs/da850evm.h| 4 ++-- include/configs/enbw_cmc.h| 4 ++-- include/configs/tnetv107x_evm.h | 4 ++-- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/arch/arm/include/asm/arch-davinci/nand_defs.h b/arch/arm/include/asm/arch-davinci/nand_defs.h index 10f3a39..4a30813 100644 --- a/arch/arm/include/asm/arch-davinci/nand_defs.h +++ b/arch/arm/include/asm/arch-davinci/nand_defs.h @@ -36,6 +36,15 @@ #defineMASK_ALE0x08 #endif +#ifdef CONFIG_SYS_NAND_MASK_CLE +#undef MASK_CLE +#define MASK_CLE CONFIG_SYS_NAND_MASK_CLE +#endif +#ifdef CONFIG_SYS_NAND_MASK_ALE +#undef MASK_ALE +#define MASK_ALE CONFIG_SYS_NAND_MASK_ALE +#endif + #define NAND_READ_START0x00 #define NAND_READ_END 0x30 #define NAND_STATUS0x70 diff --git a/include/configs/da830evm.h b/include/configs/da830evm.h index f7ac256..198892b 100644 --- a/include/configs/da830evm.h +++ b/include/configs/da830evm.h @@ -109,8 +109,8 @@ #define CONFIG_SYS_NAND_CS 3 #define CONFIG_SYS_NAND_BASE DAVINCI_ASYNC_EMIF_DATA_CE3_BASE #define CONFIG_SYS_NAND_PAGE_2K -#define CONFIG_SYS_CLE_MASK0x10 -#define CONFIG_SYS_ALE_MASK0x8 +#define CONFIG_SYS_NAND_MASK_CLE 0x10 +#define CONFIG_SYS_NAND_MASK_ALE 0x8 #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND devices */ #endif diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h index 583568d..c420967 100644 --- a/include/configs/da850evm.h +++ b/include/configs/da850evm.h @@ -199,8 +199,8 @@ #defineCONFIG_SYS_NAND_PAGE_2K #define CONFIG_SYS_NAND_CS 3 #define CONFIG_SYS_NAND_BASE DAVINCI_ASYNC_EMIF_DATA_CE3_BASE -#define CONFIG_SYS_CLE_MASK0x10 -#define CONFIG_SYS_ALE_MASK0x8 +#define CONFIG_SYS_NAND_MASK_CLE 0x10 +#define CONFIG_SYS_NAND_MASK_ALE 0x8 #undef CONFIG_SYS_NAND_HW_ECC #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND devices */ #define CONFIG_SYS_NAND_HW_ECC_OOBFIRST diff --git a/include/configs/enbw_cmc.h b/include/configs/enbw_cmc.h index 2d63b67..97bc972 100644 --- a/include/configs/enbw_cmc.h +++ b/include/configs/enbw_cmc.h @@ -118,8 +118,8 @@ #define CONFIG_SYS_NAND_PAGE_2K #define CONFIG_SYS_NAND_CS 3 #define CONFIG_SYS_NAND_BASE DAVINCI_ASYNC_EMIF_DATA_CE3_BASE -#define CONFIG_SYS_CLE_MASK0x10 -#define CONFIG_SYS_ALE_MASK0x8 +#define CONFIG_SYS_NAND_MASK_CLE 0x10 +#define CONFIG_SYS_NAND_MASK_ALE 0x8 #undef CONFIG_SYS_NAND_HW_ECC #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND devices */ diff --git a/include/configs/tnetv107x_evm.h b/include/configs/tnetv107x_evm.h index d6371fc..cabc06e 100644 --- a/include/configs/tnetv107x_evm.h +++ b/include/configs/tnetv107x_evm.h @@ -82,8 +82,8 @@ #define CONFIG_SYS_NAND_CS 2 #define CONFIG_SYS_NAND_USE_FLASH_BBT #define CONFIG_SYS_NAND_BASE TNETV107X_ASYNC_EMIF_DATA_CE0_BASE -#define CONFIG_SYS_CLE_MASK0x10 -#define CONFIG_SYS_ALE_MASK0x8 +#define CONFIG_SYS_NAND_MASK_CLE 0x10 +#define CONFIG_SYS_NAND_MASK_ALE 0x8 #define CONFIG_SYS_MAX_NAND_DEVICE 1 #define CONFIG_MTD_PARTITIONS #define CONFIG_CMD_MTDPARTS -- 1.7.11.7 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 02/14] zynq: Move scutimer baseaddr to hardware.h
On Mon, Apr 22, 2013 at 04:52:00PM +0200, Michal Simek wrote: Move baseaddr to hardware.h to be shared between configurations. Is this really configurable? If not, lets also rename it to drop CONFIG. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 08/14] zynq: Move macros to hardware.h
On Mon, Apr 22, 2013 at 04:52:06PM +0200, Michal Simek wrote: Add all fixed addresses to hardware.h and change petalinux configuration to support this. Signed-off-by: Michal Simek michal.si...@xilinx.com --- arch/arm/include/asm/arch-zynq/hardware.h | 2 ++ board/xilinx/zynq/board.c | 12 +--- include/configs/zynq.h| 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/arch-zynq/hardware.h b/arch/arm/include/asm/arch-zynq/hardware.h index bee7b09..e0f6eba 100644 --- a/arch/arm/include/asm/arch-zynq/hardware.h +++ b/arch/arm/include/asm/arch-zynq/hardware.h @@ -27,6 +27,8 @@ #define XPSS_DEV_CFG_APB_BASEADDR0xF8007000 #define XPSS_SCU_BASEADDR0xF8F0 #define CONFIG_SCUTIMER_BASEADDR 0xF8F00600 +#define CONFIG_ZYNQ_GEM_BASEADDR00xE000B000 +#define CONFIG_ZYNQ_GEM_BASEADDR10xE000C000 Are these configurable really or no? If they're in hardware.h they shouldn't be CONFIG named. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/1] TPM: STMicroelectronics u-boot driver I2C
From: Mathias Leblanc mathias.lebl...@st.com * STMicroelectronics version 1.2.0, Copyright (C) 2013 * This is free software, and you are welcome to redistribute it * under certain conditions. This is the driver for TPM chip from ST Microelectronics. If you have a TPM security chip from STMicroelectronics working with an I2C, read the README file and add the correct defines regarding the tpm in the configuration file of your board. This file is located in include/configs/your_board.h The driver will be accessible from within uboot terminal. Signed-off-by: Mathias Leblanc mathias.lebl...@st.com --- Makefile |2 +- README | 14 +- common/cmd_tpm.c | 170 +++- drivers/tpm/Makefile |1 + drivers/tpm/compatibility.h| 52 drivers/tpm/tis_i2c.c | 248 + drivers/tpm/tpm.c | 477 drivers/tpm/tpm.h | 170 +++ drivers/tpm/tpm_i2c_st.c | 599 include/configs/coreboot.h |4 +- include/configs/omap3_beagle.h |8 + include/tpm.h | 17 ++ 12 files changed, 1757 insertions(+), 5 deletions(-) create mode 100644 drivers/tpm/compatibility.h create mode 100644 drivers/tpm/tis_i2c.c create mode 100644 drivers/tpm/tpm.c create mode 100644 drivers/tpm/tpm.h create mode 100644 drivers/tpm/tpm_i2c_st.c diff --git a/Makefile b/Makefile index 12763ce..ef954a4 100644 --- a/Makefile +++ b/Makefile @@ -314,7 +314,7 @@ endif LIBS-y += drivers/rtc/librtc.o LIBS-y += drivers/serial/libserial.o LIBS-y += drivers/sound/libsound.o -LIBS-$(CONFIG_GENERIC_LPC_TPM) += drivers/tpm/libtpm.o +LIBS-$(CONFIG_TPM) += drivers/tpm/libtpm.o LIBS-y += drivers/twserial/libtws.o LIBS-y += drivers/usb/eth/libusb_eth.o LIBS-y += drivers/usb/gadget/libusb_gadget.o diff --git a/README b/README index 7f2506a..3b1b633 100644 --- a/README +++ b/README @@ -1201,7 +1201,7 @@ The following options need to be configured: If this option is set, the driver enables cache flush. - TPM Support: - CONFIG_GENERIC_LPC_TPM + CONFIG_TPM Support for generic parallel port TPM devices. Only one device per system is supported at this time. @@ -1210,6 +1210,18 @@ The following options need to be configured: to. Contemporary x86 systems usually map it at 0xfed4. + CONFIG_ST_TPM_I2C + Define to compile the ST TPM I2C DRIVER. + + CONFIG_TPM_I2C_BUS + Define the bus number of the board. + + CONFIG_TPM_I2C_ADDR + Define the address of the TPM. + + CONFIG_CMD_TPM + Define to use some TPM u-boot commands. + - USB Support: At the moment only the UHCI host controller is supported (PIP405, MIP405, MPC5200); define diff --git a/common/cmd_tpm.c b/common/cmd_tpm.c index 0970a6f..2b7bf35 100644 --- a/common/cmd_tpm.c +++ b/common/cmd_tpm.c @@ -145,10 +145,177 @@ static int do_tpm_many(cmd_tbl_t *cmdtp, int flag, return rv; } +static int do_tpm_hash(cmd_tbl_t *cmdtp, int flag, int argc, +char * const argv[]) +{ + u8 tpm_buffer[MAX_TRANSACTION_SIZE]; + u32 write_size, read_size; + char *p; + int rv = -1; + argc -= 1; + argv += 1; + u8 response[MAX_TRANSACTION_SIZE]; + u32 rlength = MAX_TRANSACTION_SIZE; + + u8 startup[] = { + 0x00, 0xc1, + 0x00, 0x00, 0x00, 0x0c, + 0x00, 0x00, 0x00, 0x99, + 0x00, 0x01 + }; + + u8 selftestfull[] = { + 0x00, 0xc1, + 0x00, 0x00, 0x00, 0x0a, + 0x00, 0x00, 0x00, 0x50 + }; + + u8 readpcr17[] = { + 0x00, 0xc1, + 0x00, 0x00, 0x00, 0x0e, + 0x00, 0x00, 0x00, 0x15, + 0x00, 0x00, 0x00, 0x11 + }; + + for (write_size = 0; write_size argc; write_size++) { + u32 datum = simple_strtoul(argv[write_size], p, 0); + if (*p || (datum 0xff)) { + printf(\n%s: bad data value\n\n, argv[write_size]); + cmd_usage(cmdtp); + return rv; + } + tpm_buffer[write_size] = (u8)datum; + } + + if (tis_init()) { + puts(tis_init() failed!\n); + return -1; + } + + if (tis_open()) { + puts(tis_open() failed!\n); + return -1; + } + + rv = tis_sendrecv(startup, sizeof(startup), response, rlength); + if (rv) { + printf(tpm test startup failed\n); + CHECK(tis_close()); + } + + rv = tis_sendrecv(selftestfull, sizeof(selftestfull),
Re: [U-Boot] [PATCH v3 0/17] sandbox: Generic board support and other improvements
Hi Tom, On Mon, Apr 22, 2013 at 8:18 AM, Tom Rini tr...@ti.com wrote: On Sat, Apr 20, 2013 at 11:42:35AM -0700, Simon Glass wrote: This series adds generic board support to sandbox and switches to use this always. With sandbox it was noticed that turning CONFIG_SYS_GENERIC_BOARD off can cause a build failure if a previous autoconf.mk exists which indicates that generic board is not supported, so a patch is provided to fix this. It is useful to convert a pointer into an 'address' in the sandbox RAM buffer - the opposite of map_sysmem(). This is added in this series and used in several places. With sandbox it is easier to read a file from the host than to use the CONFIG_OF_SEPARATE option, since this option requires knowledge of the executable image structure which is not really appropriate on the host system. A new CONFIG_OF_HOSTFILE provides this. A few related FDT changes are included in this series also. The -c option is enhanced to support passing entire scripts to sandbox. This is useful when writing non-trivial test code. Most of these patches were previously submitted as part of the verified boot effort. This series collects the independent sandbox-related patches together to make it easier to review. THe whole series is marked as version 3 for this reason. For the series, Reviewed-by: Tom Rini tr...@ti.com And I'd say 3/4/5 should be squashed into one patch, but it's your arch so I'l defer if you think it adds bisect value or similar to do it in that manner. I did that so that it could be kind-of an example of how this can be done for an arch, given that I am not planning to convert the rest. By removing the dead code in a separate step it seemed a bit clearer to me. But it's fine either way - I will squash it and resend. -- Tom Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 13/14] i2c: zynq: Add support for Xilinx Zynq
On Mon, Apr 22, 2013 at 04:52:11PM +0200, Michal Simek wrote: Support Xilinx Zynq i2c controller. Signed-off-by: Joe Hershberger joe.hershber...@ni.com Signed-off-by: Michal Simek michal.si...@xilinx.com Adding Heiko (http://patchwork.ozlabs.org/patch/238560/) ... --- arch/arm/include/asm/arch-zynq/hardware.h | 2 + drivers/i2c/Makefile | 1 + drivers/i2c/zynq_i2c.c| 304 ++ There's 3 new checkpatch warnings here, please fix. Also: --- a/arch/arm/include/asm/arch-zynq/hardware.h +++ b/arch/arm/include/asm/arch-zynq/hardware.h @@ -31,6 +31,8 @@ #define CONFIG_ZYNQ_GEM_BASEADDR10xE000C000 #define CONFIG_ZYNQ_SDHCI_BASEADDR0 0xE010 #define CONFIG_ZYNQ_SDHCI_BASEADDR1 0xE0101000 +#define CONFIG_ZYNQ_I2C_BASEADDR00xE0004000 +#define CONFIG_ZYNQ_I2C_BASEADDR10xE0005000 Same comment as before about CONFIG in hardware.h +/* Control register fields */ +#define ZYNQ_I2C_CONTROL_RW 0x0001 '#definespace', fix globally please. + /* Temporarily disable restart (by clearing hold)... */ + /* It doesn't seem to work. */ /* * Multi line comments go like this */ [snip] +# define CONFIG_HARD_I2C 1 No need for training 1 here. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/6] i2c: fsl_i2c: i2c_read(): dont try to write address w/ alen=0
On Mon, Apr 22, 2013 at 8:06 AM, Dirk Eibach eib...@gdsys.de wrote: diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c index 1c7265d..276386d 100644 --- a/drivers/i2c/fsl_i2c.c +++ b/drivers/i2c/fsl_i2c.c @@ -383,13 +383,16 @@ i2c_read(u8 dev, uint addr, int alen, u8 *data, int length) int i = -1; /* signal error */ u8 *a = (u8*)addr; - if (i2c_wait4bus() = 0 + if (i2c_wait4bus() 0) + return -1; Can you return a more descriptive error code here? ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 14/14] fpga: Add support for loading bitstream for Xilinx Zynq
On Mon, Apr 22, 2013 at 04:52:12PM +0200, Michal Simek wrote: Devcfg device requires to load bitstream in binary format. [snip] +/* Device Image Sizes + */ This is not the correct format for a comment. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Xilinx Zynq patches
On Mon, Apr 22, 2013 at 04:51:58PM +0200, Michal Simek wrote: Hi, I am sending several patches which improve Xilinx Zynq arm port in u-boot. Patchset contain: - core changes: patches 1,2 - gem update: patches 1-11 - mmc support: patch 12 - i2c support: patch 13 - pl support: patch 14 I am sending them in one package because driver depends on each other in zynq shared files. Thanks for your comments, I've read over the series and in general things look good. The only other high level comment would be that it seems checkpatch has been updated since you last made sure the series was checkpatch clean so please re-check and correct the minor problems that show up. Thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 03/11] powerpc/ppc4xx: Add fpgad command for dumping gdsys fpga registers
On Mon, Apr 22, 2013 at 01:16:04PM +0200, Dirk Eibach wrote: Signed-off-by: Dirk Eibach eib...@gdsys.de --- board/gdsys/common/Makefile |2 +- board/gdsys/common/cmd_fpga.c | 94 + There's checkpatch warning I'm guessing since I can spot some spacing issues. Also, this is a generic command, lets move it into top-level common, call it cmd_fpad.c, modify top-level README. Oh, and /* * Multiline comments go like this. */ Thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Please pull u-boot-ppc4xx/master
On Mon, Apr 22, 2013 at 10:27:21AM +0200, Stefan Roese wrote: Hi Tom! Please pull the following pending patches: The following changes since commit d10f68ae47b67acab8b110b5c605dde4197a1820: Prepare v2013.04 (2013-04-19 10:25:43 -0400) are available in the git repository at: git://www.denx.de/git/u-boot-ppc4xx.git master for you to fetch changes up to f47b048b3a283dca63cfdce46840dd477e591336: ppc4xx: Add lcd4_lwmon5 support (2013-04-22 09:53:53 +0200) Stefan Roese (3): ppc4xx: Add SPL support Makefile: Add target for combined u-boot.img spl/u-boot.bin ppc4xx: Add lcd4_lwmon5 support Makefile | 12 ++ arch/powerpc/cpu/ppc4xx/Makefile | 4 ++ arch/powerpc/cpu/ppc4xx/spl_boot.c | 72 arch/powerpc/cpu/ppc4xx/start.S| 37 +++-- arch/powerpc/cpu/ppc4xx/u-boot-spl.lds | 74 + arch/powerpc/cpu/ppc4xx/u-boot.lds | 2 + board/lwmon5/lwmon5.c | 75 +- board/lwmon5/sdram.c | 4 +- boards.cfg | 1 + config.mk | 4 ++ include/configs/lwmon5.h | 68 -- 11 files changed, 343 insertions(+), 10 deletions(-) create mode 100644 arch/powerpc/cpu/ppc4xx/spl_boot.c create mode 100644 arch/powerpc/cpu/ppc4xx/u-boot-spl.lds Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Please pull u-boot-cfi-flash/master
On Mon, Apr 22, 2013 at 11:10:14AM +0200, Stefan Roese wrote: Hi Tom, please pull the following patch: The following changes since commit d10f68ae47b67acab8b110b5c605dde4197a1820: Prepare v2013.04 (2013-04-19 10:25:43 -0400) are available in the git repository at: git://www.denx.de/git/u-boot-cfi-flash.git master for you to fetch changes up to 352ef3f1b613cb711c51ec962d2cc1eafff1bf95: flash: Add optional verify-after-write feature (2013-04-22 10:56:38 +0200) Stefan Roese (1): flash: Add optional verify-after-write feature README | 9 + common/flash.c | 11 +++ 2 files changed, 20 insertions(+) Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] config_cmd_default.h: Remove CONFIG_CMD_MEMTEST
On Fri, Apr 19, 2013 at 03:13:52PM -0400, Tom Rini wrote: As per doc/feature-removal-schedule.txt, remove CONFIG_CMD_MEMTEST from default list of commands. Signed-off-by: Tom Rini tr...@ti.com --- doc/feature-removal-schedule.txt | 17 - include/config_cmd_default.h |1 - Along with 2/2, appliedt to u-boot/master. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot