Received: from eggs.gnu.org ([2001:4830:134:3::10]:47210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK3AO-0007Td-Rg for qemu-devel@nongnu.org; Mon, 04 Jul 2016 08:40:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bK3AK-00082n-MJ for qemu-devel@nongnu.org; Mon, 04 Jul 2016 08:39:59 -0400 Received: from 17.mo3.mail-out.ovh.net ([87.98.178.58]:39212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK3AK-00082X-GX for qemu-devel@nongnu.org; Mon, 04 Jul 2016 08:39:56 -0400 Received: from player761.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo3.mail-out.ovh.net (Postfix) with ESMTP id 8B759FFBD25 for ; Mon, 4 Jul 2016 14:39:55 +0200 (CEST) References: <1467634738-28642-1-git-send-email-clg@kaod.org> <1467634738-28642-2-git-send-email-clg@kaod.org> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: <8a6e0fd8-cd84-53c2-e230-a401ffac4212@kaod.org> Date: Mon, 4 Jul 2016 14:39:43 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/7] tests: add a m25p80 test List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Peter Crosthwaite , QEMU Developers , qemu-arm , Andrew Jeffery , =?UTF-8?Q?Marcin_Krzemi=c5=84ski?= On 07/04/2016 02:24 PM, Peter Maydell wrote: > On 4 July 2016 at 13:18, C=C3=A9dric Le Goater wrote: >> This test uses the palmetto platform and the AST2400 SPI controller to >> test the m25p80 flash module device model. The flash model is defined >> by the platform (n25q256a) and it would be nice to find way to control >> it, using a property probably. >=20 >=20 >> +static inline void flash_writel(uint32_t data) >> +{ >> + data =3D cpu_to_be32(data); >> + memwrite(AST2400_FLASH_BASE, &data, 4); >> +} >> + >> +static inline uint32_t flash_readl(void) >> +{ >> + uint32_t data; >> + >> + memread(AST2400_FLASH_BASE, &data, 4); >> + return be32_to_cpu(data); >> +} >=20 > These are weird. As per my question in the other thread, if you > were writing this as a piece of test code that ran natively > in the guest, how would you write it? Here is the uboot flash code : https://github.com/openbmc/u-boot/blob/v2016.05-aspeed-openbmc/arch/arm/= mach-aspeed/flash.c#L420 So these are doing byte per byte, but there is no reason not to do long. C.