Commit Graph

22 Commits

Author SHA1 Message Date
Peter Maydell 0ec6dc730c hw/omap_gpmc: Fix region map/unmap when configuring prefetch engine
When configuring the prefetch engine (and also when resetting from
a state where the prefetch engine was enabled) be careful to adhere
to the "unmap/change config fields/map" ordering, to avoid trying
to delete the wrong MemoryRegions. This fixes an assertion failure
in some cases.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reported-by: Alexander Graf <agraf@suse.de>
Tested-by: Alexander Graf <agraf@suse.de>
2012-01-04 13:41:42 +00:00
Peter Maydell c0465d1a1d hw/omap_gpmc.c: Add missing 'break's to fix 8 bit NAND writes
Add missing 'break' statements which would have meant that writing
to an 8 bit NAND device was broken. Spotted by Coverity (see bug
887883).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-09 12:06:20 -06:00
Peter Maydell 7e36b264ce hw/omap_gpmc: Modify correct field when writing IRQSTATUS register
Writing to IRQSTATUS should affect irqst, not irqen -- error
spotted by Andrzej Zaborowski.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-09-23 08:36:58 +02:00
Peter Maydell 7196345549 hw/omap_gpmc: Add comment about FIFOTHRESHOLDSTATUS bit
Promote the remark about why we handle FIFOTHRESHOLDSTATUS the
way we do from the commit message of de8af7fe0 to a comment in
the code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-09-23 08:36:36 +02:00
Peter Maydell d5c8cf993a omap_gpmc: Implement prefetch engine
This commit implements the prefetch engine feature of the GPMC
which can be used for NAND devices. This includes both interrupt
driven and DMA-filling modes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-28 16:37:13 +00:00
Peter Maydell eee0a1c67e omap: Wire up the DMA request line to the GPMC
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-28 16:37:13 +00:00
Peter Maydell ef20677ca6 omap_gpmc: Pull prefetch engine data into sub-struct
Refactor the gpmc state structure so items relating to
the prefetch engine are in their own sub-struct and have
more useful names.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-28 16:37:13 +00:00
Juha Riihimäki 856f2df771 omap_gpmc: Accept a zero mask field on omap3630
OMAP3630 adds an extra bit of address masking, so a mask of
0xb1111 is valid. Unfortunately the GPMC_REVISION is the same as
on the OMAP3430 which only has three bits of address masking, so
we have to derive this feature directly from the OMAP revision
rather than from the GPMC revision.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by:  Peter Maydell <peter.maydell@linaro.org>
2011-08-28 16:37:13 +00:00
Peter Maydell 2a952feb83 omap_gpmc: Support NAND devices
Support accesses to NAND devices, both by mapping them into
the GPMC address space, and via the NAND_COMMAND, NAND_ADDRESS
and NAND_DATA GPMC registers.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-28 16:37:12 +00:00
Peter Maydell 9ed3e1b183 omap_gpmc: Reindent misindented switch statements
Whitespace-only change fixing indentation.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-28 16:37:12 +00:00
Juha Riihimäki 7c470ff1eb omap_gpmc: Calculate revision from OMAP model
Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by:  Peter Maydell <peter.maydell@linaro.org>
2011-08-28 16:37:12 +00:00
Juha Riihimäki b5325c2739 omap_gpmc: Take omap_mpu_state* in omap_gpmc_init
Take a pointer to the omap mpu state struct in omap_gpmc_init.
Some details of GPMC behaviour depend on the OMAP version we
are a part of.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by:  Peter Maydell <peter.maydell@linaro.org>
2011-08-28 16:37:12 +00:00
Peter Maydell de8af7fe01 omap_gpmc: Fix handling of FIFOTHRESHOLDSTATUS bit
The OMAP3 TRM is inconsistent about whether the GPMC FIFOTHRESHOLDSTATUS
bit should be set when FIFOPOINTER > FIFOTHRESHOLD or when it is >=
FIFOTHRESHOLD. Apparently the underlying functional spec from which
the TRM was created states that the behaviour is ">=", and this also
makes more conceptual sense.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-28 16:37:12 +00:00
Peter Maydell 77c6c73690 omap_gpmc: Wire up the GPMC IRQ correctly
The omap_gpmc wasn't actually wiring up its IRQ, so
anything that provoked an interrupt would be using
uninitialised data for its IRQ number.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-28 16:37:12 +00:00
Peter Maydell 9c8255e124 omap_gpmc: GPMC_IRQSTATUS is write-one-to-clear
Fix a bug in the handling of writes to GPMC_IRQSTATUS:
it behaves as "write one to clear, writing zero is ignored".

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-28 16:37:12 +00:00
Peter Maydell 3387bf5581 omap_gpmc: Refactor omap_gpmc_cs_map and omap_gpmc_cs_unmap
Refactor the omap_gpmc_cs_map/unmap functions:
 * take the omap_gpmc_s* and a chipselect id rather than the
   omap_gpmc_cs_file_s*, so they have access to the general gpmc
   member fields
 * extract the base and mask from the config registers in the functions
   rather than at every callsite
 * check for CSVALID in the functions rather than at every callsite

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-28 16:37:12 +00:00
Peter Maydell 07bc2f8077 omap_gpmc: Clean up omap_gpmc_attach MemoryRegion conversion
Now that all callers of omap_gpmc_attach pass in a MemoryRegion*,
we can remove the base_update and unmap function pointer arguments,
and the opaque pointer that was passed into these callbacks.

We can also remove the base and size fields from omap_gpmc_cs_file_s
as these are no longer necessary (you don't need the base/size
to unmap a MemoryRegion the way you did to undo a mapping made
with cpu_register_physical_memory()).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-28 16:37:12 +00:00
Peter Maydell 710ffe6048 hw/omap_gpmc: Don't try to map CS0 twice on reset
Remove a spurious second map of the OMAP GPMC CS0 region on reset.
This fixes an assertion failure when we try to add the region to
its container when it was already added. (The old code did not
complain about mismatched map/unmap calls, but the new MemoryRegion
implementation does.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-08-23 21:51:47 +02:00
Avi Kivity 64066a8fb6 omap_gpmc/nseries/tusb6010: convert to memory API
Somewhat clumsy since it needs a variable sized region.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-22 10:21:57 -05:00
Anthony Liguori 7267c0947d Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-20 23:01:08 -05:00
Alexander Graf 2507c12ab0 Add endianness as io mem parameter
As stated before, devices can be little, big or native endian. The
target endianness is not of their concern, so we need to push things
down a level.

This patch adds a parameter to cpu_register_io_memory that allows a
device to choose its endianness. For now, all devices simply choose
native endian, because that's the same behavior as before.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:25 +00:00
cmchao f3354b0e5d hw/omap2.c : separate gpmc(general purpose memory controller)
Signed-off-by: cmchao <cmchao@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-06-30 20:41:36 +02:00