All of lore.kernel.org
 help / color / mirror / Atom feed
From: "mar.krzeminski" <mar.krzeminski@gmail.com>
To: "Cédric Le Goater" <clg@kaod.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Peter Crosthwaite" <crosthwaite.peter@gmail.com>
Cc: Andrew Jeffery <andrew@aj.id.au>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-arm] [PATCH 4/7] m25p80: add a m25p80_set_rom_storage() routine
Date: Wed, 6 Jul 2016 19:44:09 +0200	[thread overview]
Message-ID: <577D4369.1050408@gmail.com> (raw)
In-Reply-To: <f9b1192b-27ef-ae8f-947d-0a5151fbe26d@kaod.org>



W dniu 06.07.2016 o 18:30, Cédric Le Goater pisze:
> On 07/04/2016 08:12 PM, Cédric Le Goater wrote:
>> On 07/04/2016 07:57 PM, mar.krzeminski wrote:
>>>
>>> W dniu 04.07.2016 o 14:18, Cédric Le Goater pisze:
>>>> Some SPI controllers, such as the Aspeed AST2400, have a mode in which
>>>> accesses to the flash content are no different than doing MMIOs. The
>>>> controller generates all the necessary commands to load (or store)
>>>> data in memory.
>>>>
>>>> To emulate such a behavior, we need to have access to the underlying
>>>> storage of the flash object. The purpose of the routine is to set the
>>>> storage of a preinitialized SPI flash object, which can then be used
>>>> by the object itself but also by a SPI controller to handled the
>>>> MMIOs.
>>> Hi,
>>>
>>> I am not sure if this approach is correct. I can not find any datasheet
>>> to this SPI controller, but as you mentioned in first paragraph, controller
>>> generates all commands (probably ones are somehow configurable).
>> yes. see this patch :
>>
>> 	http://lists.nongnu.org/archive/html/qemu-devel/2016-06/msg08229.html
>>
>> 	/* CEx Control Register */
>> 	#define R_CTRL0           (0x10 / 4)
>> 	#define   CTRL_CMD_SHIFT           16
>> 	#define   CTRL_CMD_MASK            0xff
>>
>>
>>> In this series you hack this behaviour and you do direct access to file.
>> It is true it is not very respectful of the m25p80 interface.
>>
>>> IMHO you should emulate sending such commands in SPI controller
>>> model.
>> I will give it a try. I don't think the alternative is a complex
>> change anyhow.
> So yes, that would work out pretty well. But there is another need
> that does not show up in the series (I am not splitting the patches
> correctly I guess) We would like to boot directly from a flash image.
> For this purpose, the pflash_cfi object uses a memory region of type
> rom and uses the storage behind the region.
>
> m25p80_set_rom_storage() is probably not the right API to share the
> storage. I am looking for a way to handle this without changing too
> much m25p80, which does not have a mem region currently. Suggestions
> welcomed ! :)
I do not know if this is a good idea - for sure yet another complication,
but we still should process like the HW. The flash is memory mapped
to some memory area, so maybe creating alias to this memory area
would help with the implementation?
Then read will be still done by SPI and m25p80. Some configuration
from the board level might be needed to initialise the controller
(or maybe defaults are ok - depends how it is done in hw).

Regards,
Marcin
> Thanks,
>
> C.
>
>


WARNING: multiple messages have this Message-ID (diff)
From: "mar.krzeminski" <mar.krzeminski@gmail.com>
To: "Cédric Le Goater" <clg@kaod.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Peter Crosthwaite" <crosthwaite.peter@gmail.com>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org,
	Andrew Jeffery <andrew@aj.id.au>
Subject: Re: [Qemu-devel] [PATCH 4/7] m25p80: add a m25p80_set_rom_storage() routine
Date: Wed, 6 Jul 2016 19:44:09 +0200	[thread overview]
Message-ID: <577D4369.1050408@gmail.com> (raw)
In-Reply-To: <f9b1192b-27ef-ae8f-947d-0a5151fbe26d@kaod.org>



W dniu 06.07.2016 o 18:30, Cédric Le Goater pisze:
> On 07/04/2016 08:12 PM, Cédric Le Goater wrote:
>> On 07/04/2016 07:57 PM, mar.krzeminski wrote:
>>>
>>> W dniu 04.07.2016 o 14:18, Cédric Le Goater pisze:
>>>> Some SPI controllers, such as the Aspeed AST2400, have a mode in which
>>>> accesses to the flash content are no different than doing MMIOs. The
>>>> controller generates all the necessary commands to load (or store)
>>>> data in memory.
>>>>
>>>> To emulate such a behavior, we need to have access to the underlying
>>>> storage of the flash object. The purpose of the routine is to set the
>>>> storage of a preinitialized SPI flash object, which can then be used
>>>> by the object itself but also by a SPI controller to handled the
>>>> MMIOs.
>>> Hi,
>>>
>>> I am not sure if this approach is correct. I can not find any datasheet
>>> to this SPI controller, but as you mentioned in first paragraph, controller
>>> generates all commands (probably ones are somehow configurable).
>> yes. see this patch :
>>
>> 	http://lists.nongnu.org/archive/html/qemu-devel/2016-06/msg08229.html
>>
>> 	/* CEx Control Register */
>> 	#define R_CTRL0           (0x10 / 4)
>> 	#define   CTRL_CMD_SHIFT           16
>> 	#define   CTRL_CMD_MASK            0xff
>>
>>
>>> In this series you hack this behaviour and you do direct access to file.
>> It is true it is not very respectful of the m25p80 interface.
>>
>>> IMHO you should emulate sending such commands in SPI controller
>>> model.
>> I will give it a try. I don't think the alternative is a complex
>> change anyhow.
> So yes, that would work out pretty well. But there is another need
> that does not show up in the series (I am not splitting the patches
> correctly I guess) We would like to boot directly from a flash image.
> For this purpose, the pflash_cfi object uses a memory region of type
> rom and uses the storage behind the region.
>
> m25p80_set_rom_storage() is probably not the right API to share the
> storage. I am looking for a way to handle this without changing too
> much m25p80, which does not have a mem region currently. Suggestions
> welcomed ! :)
I do not know if this is a good idea - for sure yet another complication,
but we still should process like the HW. The flash is memory mapped
to some memory area, so maybe creating alias to this memory area
would help with the implementation?
Then read will be still done by SPI and m25p80. Some configuration
from the board level might be needed to initialise the controller
(or maybe defaults are ok - depends how it is done in hw).

Regards,
Marcin
> Thanks,
>
> C.
>
>

  reply	other threads:[~2016-07-06 17:44 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-04 12:18 [Qemu-arm] [PATCH 0/7] ast2400: U-boot support Cédric Le Goater
2016-07-04 12:18 ` [Qemu-devel] " Cédric Le Goater
2016-07-04 12:18 ` [Qemu-devel] [PATCH 1/7] tests: add a m25p80 test Cédric Le Goater
2016-07-04 12:18   ` Cédric Le Goater
2016-07-04 12:24   ` [Qemu-arm] " Peter Maydell
2016-07-04 12:24     ` [Qemu-devel] " Peter Maydell
2016-07-04 12:39     ` Cédric Le Goater
2016-07-04 12:39       ` Cédric Le Goater
2016-07-04 12:51       ` [Qemu-arm] " Peter Maydell
2016-07-04 12:51         ` [Qemu-devel] " Peter Maydell
2016-07-04 13:08         ` Cédric Le Goater
2016-07-04 13:08           ` Cédric Le Goater
2016-07-04 12:18 ` [Qemu-devel] [PATCH 2/7] m25p80: add mx25l25635f chip Cédric Le Goater
2016-07-04 12:18   ` Cédric Le Goater
2016-07-04 12:57   ` Krzeminski, Marcin (Nokia - PL/Wroclaw)
2016-07-04 13:41     ` Cédric Le Goater
2016-07-04 15:23       ` [Qemu-devel] Odp.: " Krzeminski, Marcin (Nokia - PL/Wroclaw)
2016-07-04 15:48         ` [Qemu-arm] Odp.: [Qemu-devel] " Cédric Le Goater
2016-07-04 15:48           ` [Qemu-devel] Odp.: " Cédric Le Goater
2016-07-04 16:03           ` [Qemu-arm] Odp.: Odp.: [Qemu-devel] " Krzeminski, Marcin (Nokia - PL/Wroclaw)
2016-07-04 16:03             ` [Qemu-devel] Odp.: Odp.: " Krzeminski, Marcin (Nokia - PL/Wroclaw)
2016-07-04 16:18             ` Cédric Le Goater
2016-07-04 12:18 ` [Qemu-arm] [PATCH 3/7] ast2400: use a " Cédric Le Goater
2016-07-04 12:18   ` [Qemu-devel] " Cédric Le Goater
2016-07-04 12:18 ` [Qemu-arm] [PATCH 4/7] m25p80: add a m25p80_set_rom_storage() routine Cédric Le Goater
2016-07-04 12:18   ` [Qemu-devel] " Cédric Le Goater
2016-07-04 17:57   ` [Qemu-arm] " mar.krzeminski
2016-07-04 17:57     ` [Qemu-devel] " mar.krzeminski
2016-07-04 18:12     ` [Qemu-arm] " Cédric Le Goater
2016-07-04 18:12       ` [Qemu-devel] " Cédric Le Goater
2016-07-04 18:42       ` [Qemu-arm] " mar.krzeminski
2016-07-04 18:42         ` [Qemu-devel] " mar.krzeminski
2016-07-06 16:30       ` Cédric Le Goater
2016-07-06 16:30         ` Cédric Le Goater
2016-07-06 17:44         ` mar.krzeminski [this message]
2016-07-06 17:44           ` mar.krzeminski
2016-07-09 23:38     ` Peter Crosthwaite
2016-07-09 23:38       ` Peter Crosthwaite
2016-07-11 16:37       ` [Qemu-arm] " Cédric Le Goater
2016-07-11 16:37         ` [Qemu-devel] " Cédric Le Goater
2016-09-23  7:19     ` [Qemu-arm] " Cédric Le Goater
2016-09-23  7:19       ` [Qemu-devel] " Cédric Le Goater
2016-09-23  8:17       ` [Qemu-arm] " Peter Maydell
2016-09-23  8:17         ` [Qemu-devel] " Peter Maydell
2016-09-23  8:28         ` Cédric Le Goater
2016-09-23  8:28           ` Cédric Le Goater
2016-09-23 18:26           ` [Qemu-arm] " mar.krzeminski
2016-09-23 18:26             ` [Qemu-devel] " mar.krzeminski
2016-09-24  8:25             ` [Qemu-arm] " Cédric Le Goater
2016-09-24  8:25               ` [Qemu-devel] " Cédric Le Goater
2016-09-24  8:55               ` [Qemu-arm] " Edgar E. Iglesias
2016-09-24  8:55                 ` [Qemu-devel] " Edgar E. Iglesias
2016-09-26  8:25                 ` [Qemu-arm] [Qemu-devel] " KONRAD Frederic
2016-09-26  8:25                   ` [Qemu-devel] [Qemu-arm] " KONRAD Frederic
2016-09-26  8:56                   ` [Qemu-arm] [Qemu-devel] " Cédric Le Goater
2016-09-26  8:56                     ` [Qemu-devel] [Qemu-arm] " Cédric Le Goater
2016-09-26 21:25                     ` [Qemu-arm] [Qemu-devel] " mar.krzeminski
2016-09-26 21:25                       ` [Qemu-devel] [Qemu-arm] " mar.krzeminski
2016-07-04 12:18 ` [Qemu-devel] [PATCH 5/7] ast2400: handle SPI flash Command mode (read only) Cédric Le Goater
2016-07-04 12:18   ` Cédric Le Goater
2016-07-04 12:18 ` [Qemu-arm] [PATCH 6/7] ast2400: use contents of first SPI flash as a rom Cédric Le Goater
2016-07-04 12:18   ` [Qemu-devel] " Cédric Le Goater
2016-07-04 14:58   ` Cédric Le Goater
2016-07-04 14:58     ` Cédric Le Goater
2016-07-04 12:18 ` [Qemu-devel] [PATCH 7/7] ast2400: add a memory controller device model Cédric Le Goater
2016-07-04 12:18   ` Cédric Le Goater
2016-07-06  4:34   ` [Qemu-arm] " Andrew Jeffery
2016-07-06  4:34     ` [Qemu-devel] " Andrew Jeffery
2016-07-06  6:51     ` Cédric Le Goater
2016-07-06  6:51       ` Cédric Le Goater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=577D4369.1050408@gmail.com \
    --to=mar.krzeminski@gmail.com \
    --cc=andrew@aj.id.au \
    --cc=clg@kaod.org \
    --cc=crosthwaite.peter@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.