Skip to content
Permalink
Browse files

Merge commit 'rel_imx_2.6.28_4.5.1' into falconwing

Conflicts:
	arch/arm/mach-stmp3xxx/emi.inc
	arch/arm/mach-stmp3xxx/include/mach/memory.h
	arch/arm/mach-stmp3xxx/stmp378x_devb.c
	drivers/input/keyboard/Kconfig
	drivers/input/keyboard/Makefile
	sound/soc/codecs/stmp378x_codec.c
  • Loading branch information...
guyc committed Feb 14, 2012
2 parents 97606fe + 12a78a3 commit 7d56fb5127ee4678cf4b278033184153b5b5c0e5
Showing with 17,863 additions and 1,385 deletions.
  1. +369 −0 Documentation/imx_nfc.txt
  2. +1 −0 arch/arm/Kconfig
  3. +4 −3 arch/arm/configs/imx233_defconfig
  4. +961 −0 arch/arm/configs/imx233_updater_defconfig
  5. +18 −8 arch/arm/configs/imx25_3stack_defconfig
  6. +18 −8 arch/arm/configs/imx35_3stack_defconfig
  7. +18 −20 arch/arm/configs/imx51_defconfig
  8. +18 −0 arch/arm/mach-mx25/Kconfig
  9. +16 −11 arch/arm/mach-mx25/clock.c
  10. +25 −0 arch/arm/mach-mx25/cpu.c
  11. +32 −0 arch/arm/mach-mx25/devices.c
  12. +5 −1 arch/arm/mach-mx25/dma.c
  13. +9 −0 arch/arm/mach-mx25/iomux.h
  14. +81 −2 arch/arm/mach-mx25/mx25_3stack.c
  15. +11 −0 arch/arm/mach-mx25/mx25_3stack_cpld.c
  16. +117 −3 arch/arm/mach-mx25/mx25_3stack_gpio.c
  17. +43 −3 arch/arm/mach-mx3/clock.c
  18. +3 −2 arch/arm/mach-mx3/crm_regs.h
  19. +2 −2 arch/arm/mach-mx3/devices.c
  20. +167 −12 arch/arm/mach-mx3/mx31ads.c
  21. +10 −5 arch/arm/mach-mx3/mx3_3stack.c
  22. +14 −0 arch/arm/mach-mx3/mx3_3stack_pmic_mc13783.c
  23. +1 −8 arch/arm/mach-mx3/mxc_pm.c
  24. +1 −7 arch/arm/mach-mx3/usb.h
  25. +2 −8 arch/arm/mach-mx3/usb_h2.c
  26. +0 −1 arch/arm/mach-mx35/board-mx35_3stack.h
  27. +62 −5 arch/arm/mach-mx35/clock.c
  28. +7 −0 arch/arm/mach-mx35/crm_regs.h
  29. +27 −0 arch/arm/mach-mx35/devices.c
  30. +12 −8 arch/arm/mach-mx35/mx35_3stack.c
  31. +7 −0 arch/arm/mach-mx35/mx35_3stack_gpio.c
  32. +18 −1 arch/arm/mach-mx35/mx35_3stack_pmic_mc9s08dz60.c
  33. +11 −11 arch/arm/mach-mx35/mx35_pins.h
  34. +141 −12 arch/arm/mach-mx37/bus_freq.c
  35. +267 −76 arch/arm/mach-mx37/clock.c
  36. +7 −0 arch/arm/mach-mx37/devices.c
  37. +6 −6 arch/arm/mach-mx37/mx37_3stack.c
  38. +11 −0 arch/arm/mach-mx37/mx37_3stack_pmic_wm8350.c
  39. +17 −1 arch/arm/mach-mx37/usb_dr.c
  40. +128 −60 arch/arm/mach-mx51/bus_freq.c
  41. +103 −34 arch/arm/mach-mx51/clock.c
  42. +5 −0 arch/arm/mach-mx51/cpu.c
  43. +197 −6 arch/arm/mach-mx51/devices.c
  44. +110 −17 arch/arm/mach-mx51/mx51_3stack.c
  45. +0 −73 arch/arm/mach-mx51/mx51_3stack_gpio.c
  46. +35 −4 arch/arm/mach-mx51/mx51_3stack_pmic_mc13892.c
  47. +345 −43 arch/arm/mach-mx51/mx51_babbage.c
  48. +199 −77 arch/arm/mach-mx51/mx51_babbage_gpio.c
  49. +36 −0 arch/arm/mach-mx51/mx51_babbage_pmic_mc13892.c
  50. +7 −2 arch/arm/mach-mx51/usb_h1.c
  51. +7 −0 arch/arm/mach-stmp3xxx/Kconfig
  52. +1 −1 arch/arm/mach-stmp3xxx/Makefile
  53. +22 −0 arch/arm/mach-stmp3xxx/devices.c
  54. +3 −3 arch/arm/mach-stmp3xxx/emi.inc
  55. +29 −0 arch/arm/mach-stmp3xxx/include/mach/memory.h
  56. +4 −1 arch/arm/mach-stmp3xxx/include/mach/stmp3xxx.h
  57. +1 −7 arch/arm/mach-stmp3xxx/mmc.c
  58. +1 −0 arch/arm/mach-stmp3xxx/pm.c
  59. +22 −0 arch/arm/mach-stmp3xxx/stmp378x.c
  60. +16 −2 arch/arm/mach-stmp3xxx/stmp378x_devb.c
  61. +7 −0 arch/arm/plat-mxc/Kconfig
  62. +3 −0 arch/arm/plat-mxc/Makefile
  63. +143 −21 arch/arm/plat-mxc/clock.c
  64. +55 −21 arch/arm/plat-mxc/cpufreq.c
  65. +211 −62 arch/arm/plat-mxc/dvfs_core.c
  66. +11 −1 arch/arm/plat-mxc/include/mach/fsl_usb.h
  67. +6 −0 arch/arm/plat-mxc/include/mach/hardware.h
  68. +12 −2 arch/arm/plat-mxc/include/mach/mx25.h
  69. +1 −0 arch/arm/plat-mxc/include/mach/mx51.h
  70. +109 −0 arch/arm/plat-mxc/include/mach/mxc.h
  71. +51 −0 arch/arm/plat-mxc/include/mach/mxc_dvfs.h
  72. +33 −0 arch/arm/plat-mxc/include/mach/mxc_edid.h
  73. +300 −0 arch/arm/plat-mxc/pwm.c
  74. +68 −68 arch/arm/plat-mxc/usb_common.c
  75. +19 −30 arch/arm/plat-mxc/utmixc.c
  76. +7 −1 drivers/char/Kconfig
  77. +1 −0 drivers/char/Makefile
  78. +38 −16 drivers/char/imx_sim.c
  79. +2 −7 drivers/char/mxc_iim.c
  80. +175 −0 drivers/char/mxs_viim.c
  81. +6 −0 drivers/input/keyboard/Kconfig
  82. +2 −1 drivers/input/keyboard/Makefile
  83. +248 −0 drivers/input/keyboard/mc9s08dz60_keyb.c
  84. +4 −10 drivers/media/video/mxc/capture/csi_v4l2_capture.c
  85. +8 −4 drivers/media/video/mxc/capture/fsl_csi.c
  86. +1 −1 drivers/media/video/mxc/capture/mxc_v4l2_capture.c
  87. +84 −35 drivers/media/video/mxc/capture/ov2640.c
  88. +271 −120 drivers/media/video/mxc/output/mxc_v4l2_output.c
  89. +5 −0 drivers/media/video/mxc/output/mxc_v4l2_output.h
  90. +2 −2 drivers/media/video/videobuf-dma-contig.c
  91. +14 −4 drivers/mmc/host/mx_sdhci.c
  92. +6 −0 drivers/mmc/host/stmp3xxx_mmc.c
  93. +2 −0 drivers/mtd/devices/Makefile
  94. +1,031 −0 drivers/mtd/devices/mxc_dataflash.c
  95. +6 −0 drivers/mtd/nand/Kconfig
  96. +1 −0 drivers/mtd/nand/Makefile
  97. +8,286 −0 drivers/mtd/nand/imx_nfc.c
  98. +31 −9 drivers/mtd/nand/mxc_nd2.c
  99. +7 −3 drivers/mtd/nand/mxc_nd2.h
  100. +132 −83 drivers/mxc/asrc/mxc_asrc.c
  101. +57 −4 drivers/mxc/ipu3/ipu_common.c
  102. +3 −1 drivers/mxc/ipu3/ipu_disp.c
  103. +79 −5 drivers/mxc/ipu3/ipu_ic.c
  104. +7 −2 drivers/mxc/ipu3/ipu_param_mem.h
  105. +3 −1 drivers/mxc/ipu3/ipu_prv.h
  106. +4 −2 drivers/mxc/ipu3/ipu_regs.h
  107. +74 −0 drivers/mxc/mcu_pmic/mc9s08dz60.c
  108. +2 −0 drivers/mxc/pmic/core/pmic_core_spi.c
  109. +1 −1 drivers/mxc/pmic/mc13892/pmic_adc.c
  110. +13 −2 drivers/mxc/pmic/mc13892/pmic_battery.c
  111. +4 −2 drivers/mxc/security/dryice.c
  112. +4 −4 drivers/net/can/flexcan/mbm.c
  113. +32 −1 drivers/net/enc28j60.c
  114. +15 −5 drivers/net/fec.c
  115. +31 −19 drivers/rtc/rtc-imxdi.c
  116. +25 −22 drivers/rtc/rtc-mxc_v2.c
  117. +1 −1 drivers/spi/mxc_spi.c
  118. +15 −19 drivers/usb/core/hcd.c
  119. +42 −20 drivers/usb/core/hub.c
  120. +7 −7 drivers/usb/gadget/Kconfig
  121. +100 −70 drivers/usb/gadget/arcotg_udc.c
  122. +16 −0 drivers/usb/gadget/arcotg_udc.h
  123. +55 −4 drivers/usb/gadget/file_storage.c
  124. +473 −0 drivers/usb/gadget/stmp_updater.c
  125. +139 −0 drivers/usb/gadget/stmp_updater.h
  126. +0 −16 drivers/usb/host/Kconfig
  127. +38 −26 drivers/usb/host/ehci-arc.c
  128. +1 −1 drivers/usb/host/ehci-hcd.c
  129. +4 −1 drivers/usb/otg/fsl_otg.h
  130. +2 −2 drivers/video/backlight/pwm_bl.c
  131. +1 −0 drivers/video/mxc/Kconfig
  132. +2 −1 drivers/video/mxc/Makefile
  133. +6 −7 drivers/video/mxc/mx2fb.c
  134. +90 −0 drivers/video/mxc/mxc_edid.c
  135. +33 −19 drivers/video/mxc/mxc_ipuv3_fb.c
  136. +6 −3 drivers/video/mxc/mxcfb_epson_vga.c
  137. +1 −0 include/linux/fsl_devices.h
  138. +17 −0 include/linux/ipu.h
  139. +1 −0 include/linux/mxc_v4l2.h
  140. +0 −1 include/linux/usb/ehci_def.h
  141. +2 −0 sound/arm/mxc-alsa-spdif.c
  142. +5 −0 sound/soc/codecs/Kconfig
  143. +2 −0 sound/soc/codecs/Makefile
  144. +592 −0 sound/soc/codecs/ak5702.c
  145. +130 −0 sound/soc/codecs/ak5702.h
  146. +75 −28 sound/soc/codecs/sgtl5000.c
  147. +164 −3 sound/soc/codecs/stmp378x_codec.c
  148. +2 −2 sound/soc/codecs/wm8350.c
  149. +8 −0 sound/soc/imx/Kconfig
  150. +2 −0 sound/soc/imx/Makefile
  151. +229 −0 sound/soc/imx/imx-3stack-ak5702.c
  152. +2 −3 sound/soc/imx/imx-3stack-sgtl5000.c
  153. +3 −3 sound/soc/imx/imx-3stack-wm8580.c
  154. +23 −18 sound/soc/imx/imx-esai.c
  155. +1 −1 sound/soc/imx/imx-pcm.c
  156. +10 −3 sound/soc/imx/imx-ssi.c
@@ -0,0 +1,369 @@
i.MX NAND Flash Controller Driver Documentation
===============================================


Definitions of Terms
====================

To avoid confusion, let's carefully define some of the terms we'll be using:

"NAND Flash Chip" or "Chip"
A NAND Flash storage array and controller (including a chip select
signal, ready/busy signal, data register, etc.).

"NAND Flash Package" or "Package"
A hardware package containing one or more NAND Flash chips that share
data lines and most control signals, but with separate chip select
and ready/busy signals. Package "boundaries" are unimportant to MTD.

"NAND Flash Medium" or "Medium"
A collection of one or more NAND Flash chips that the system views as
logically contiguous.

"Memory Technology Device" or "MTD"
An abstraction of underlying memory hardware, represented by a single
struct mtd_info.

"NAND Flash MTD"
An abstraction of a NAND Flash medium that is represented by a single
struct nand_chip (the name of this structure is misleading because it
has evolved to represent an entire medium, not just a single chip).
All the physical chips in a NAND Flash MTD medium have answered the
"Read ID" command with the same manufacturer code and device code and
are presumed to have identical characteristics.

"NAND Flash MTD Hardware-independent Layer" or "HIL"
The code that implements an MTD interface and drives all NAND Flash
MTDs.

"NAND Flash MTD Hardware Abstraction Layer" or "HAL"
Code that implements the internal NAND Flash hardware model and
matches it to specific hardware.

"NAND Flash MTD Reference Implementation"
A reference implementation of a HAL "stack."

"Out-of-Band" or "OOB"
An adjective describing information that is not part of the "data" in
a NAND Flash page. NAND Flash pages are generally described in terms
of the amount of data they can hold (e.g., "2K pages" or "4K pages").
The physical page size is actually larger than this and the
additional bytes are called "out-of-band."



The Structure of the MTD NAND Flash System
==========================================

The following figure illustrates how control flows down from the system's
MTD interface into the NAND Flash MTD system and down to the hardware-
specific implementation (this driver):



/ +---------------------------------------+
| | MTD |
| +---------------------------------------+
MTD | |
| | +----------+
| | | |
| v v |
\ ======================================== |
- struct mtd_info |
/ ======================================== |
| | |
| v |
| +---------------------------------------+ |
| | NAND Flash MTD | |
NAND Flash | | Interface Functions | |
Hardware- | +---------------------------------------+ |
Independent | | | |
Layer | | v |
(HIL) | +-------------+ | +-------------+ +-------------+
| | Init | | | Support | | Reference |
| | Functions | | | Functions | |BBT Functions|
| +-------------+ | +-------------+ +-------------+
| | | | ^
| v v v |
\ ======================================== |
- struct nand_chip |
/ ======================================== |
| | ^ | ^ | |
NAND Flash | | | | | | |
Hardware | v | v | | |
Abstraction | +--------------+ +---------------+ | |
Layer | | Hardware- | | Reference | +-----------+
(HAL) | | Specific | | |
| |Implementation| |Implementations|
\ +--------------+ +---------------+



The function pointers and attributes in struct mtd_info embody an abstract
model of memory technology devices.

The struct nand_chip is an aggregation of two categories of function pointers
and attributes:

- Function pointers and attributes used by the HIL. These members embody
an abstract model of NAND Flash media, or a hardware abstraction
layer (HAL).

- Function pointers and attributes used by the reference implementations.

The single most confusing thing about the MTD NAND Flash system is that
struct nand_chip contains all the main HAL members mixed up with all the
members used only by the reference implementation, without any clear
distinction. Recognizing the distinction is critical for understanding the
relationship between the HIL and HAL, and can greatly simplify driver
implementation.

The fundamental operations represented by the function pointers in
struct nand_chip fall into the following categories (from conceptually
"low-level" to "high-level"):

- Signal Control
- Chip Control
- Low-level I/O
- ECC Control
- ECC-aware I/O
- Error Recovery
- High-level I/O
- Bad Block Management

The HIL uses only the following "Replaceable" function pointers in
struct nand_chip:

- Signal Control
- None
- Chip Control
- dev_ready
- select_chip
- cmdfunc
- waitfunc
- Low-level I/O
- read_byte
- ECC Control
- None
- ECC-aware I/O
- ecc.read_page
- ecc.read_page_raw
- Error Recovery
- None
- High-level I/O
- write_page
- ecc.read_oob
- ecc.write_oob
- Bad Block Management
- block_bad
- block_markbad
- scan_bbt

Note that the HIL calls erase_cmd, but this member is marked "Internal."

The HIL uses only the following commands with cmdfunc:

* NAND_CMD_STATUS
- nand_check_wp() - Checks if the current chip is
write-protected.
* NAND_CMD_READID
- nand_get_flash_type() - Gets information about the first chip.
- nand_scan_ident() - Scans for additional chips.
* NAND_CMD_RESET
- nand_do_write_oob() - Clears a bug observed on the
Toshiba TC5832DC and DiskOnChip 2000.
* NAND_CMD_READ0
- nand_do_read_ops() - Used to begin a full page read (both with
and without ECC).
* NAND_CMD_ERASE1
- single_erase_cmd() - Starts a block erase operation.
- multi_erase_cmd() - Starts a block erase operation.
* NAND_CMD_ERASE2
- single_erase_cmd() - Finishes a block erase operation.
- multi_erase_cmd() - Finishes a block erase operation.


Since this is all the HIL uses, this is all a driver needs to implement.



The Structure of the imx_nfc Driver
===================================

This driver supports many different versions of underlying controller, and
also supports higher-level abstractions like interleaving. To facilitate this
versatility, the code is layered as shown in the following diagram:


+--------------------------------------+
| MTD |
+--------------------------------------+
| NAND Flash MTD |
======================================== <-- struct nand_chip
/ | MTD Interface Layer (mil_*) |
| | +----------------------------------+
| | | Medium Abstraction Layer (mal_*) |
imx_nfc | | | |
driver | | | +------------------------+
| | | | NFC Utils (nfc_util_*) |
| ======================================== <-- struct nfc_hal
\ | NFC HAL (nfc_x_y_*) |
======================================== <-- Hardware Interface
| NFC Hardware |
+--------------------------------------+


MTD Interface Layer
-------------------
This layer includes functions that the NAND Flash MTD system calls directly.
In a manner of speaking, this layer "parses" the function calls made by MTD
and translates them into fundamental operations understood by the Medium
Abstraction Layer. Some simple operations don't need any abstraction, so code
in this layer can sometimes use the NFC HAL directly.


Medium Abstraction Layer
------------------------
This layer implements the abstract model of the NAND Flash medium and hides
details that shouldn't concern higher layers (e.g., interleaving).


NFC Utilities
-------------
These functions make it easier to use the NFC HAL. Even though this layer
is shown above the NFC HAL in the diagram, it's actually possible for the
NFC HAL to call some of these functions.


NFC HAL
-------
This layer implements the abstract model of an i.MX NAND Flash controller.


Other Collections of Functions
------------------------------

- System Interface
- imx_nfc_*

- sysfs Interface
- get_module_*
- set_module_*
- show_device_*
- store_device_*




i.MX NAND Flash Controller Versions
===================================

The i.MX NAND Flash controller (NFC) has evolved over time. Both its memory
layout and behaviors have changed. In this driver, we use major and minor
version numbers to label these stages in the NFC's evolution. These version
numbers are very useful, but they are entirely a figment of this driver's
imagination -- you will never find them in Freescale hardware reference
manuals.

When the platform code instantiates an i.MX NFC device, it provides a struct
imx_nfc_platform_data that contains platform-specific information. This
includes the major and minor version numbers for the NFC. This driver uses
the version numbers to select an appopriate NFC HAL structure.



i.MX NFC Memory Map
===================

While many things have changed during the evolution of the NFC, much has
remained the same. All i.MX NFCs have two or three essential memory-mapped
regions: a set of buffers, and one or two sets of registers (one on the AXI
bus and perhaps a second on the IP bus).

The buffer area contains the captive memory to which the NFC writes data
received from the NAND Flash medium. This area is subdivided into several
contiguous "main" buffers that hold 512-byte chunks of data, and several
"spare" buffers that hold varying-size chunks of out-of-band bytes. The
number of main buffers is always the same as the number of spare buffers, but
the exact count and the size of the spare buffers varies across NFC versions.

The register areas contain the NFC's control interface. Some versions have
only one set of registers, and some have two.

The platform-specific resources passed to this driver include the starting
and ending physical addresses of the buffer and register areas. This driver
maps those physical addresses to virtual addresses, and then uses version-
specific offsets and bit masks to operate the NFC.



Matching the NAND Flash MTD Page Model with the i.MX NFC
========================================================

The NAND Flash MTD HAL model views a page as containing two essentially
independent groups of bytes: "data" bytes and "out-of-band" bytes. If the
underlying physical format has data and out-of-band bytes distributed across
the page, they must be reassembled before being delivered to the caller
(e.g., see the function nand_read_page_syndrome(), which is part of the
reference implementation).

The i.MX NFC hardware imposes both a physical page layout and a layout in its
memory buffer that differ from the HAL model. The following figure shows how
all these layouts relate to each other:


i.MX NFC i.MX NFC
Physical Memory NAND Flash
Page Buffers MTD Model

+--------+ +--------+ +--------+
|OOB[N-1]| |OOB[N-1]| |OOB[N-1]|
+--------+ +--------+ +--------+
| | <gap> |OOB[ 1 ]|
| Data | +--------+ +--------+
| [N-1] | |OOB[ 1 ]| |OOB[ 0 ]|
| | +--------+ +--------+
+--------+ <gap>
... +--------+ +--------+
+--------+ |OOB[ 0 ]| | |
|OOB[ 1 ]| +--------+ | Data |
+--------+ | | | [N-1] |
| | | Data | | |
| Data | | [N-1] | +--------+
| [ 1 ] | | | | |
| | +--------+ | Data |
+--------+ ... | [ 1 ] |
|OOB[ 0 ]| +--------+ | |
+--------+ | | +--------+
| | | Data | | |
| Data | | [ 1 ] | | Data |
| [ 0 ] | | | | [ 0 ] |
| | +--------+ | |
+--------+ | | +--------+
| Data |
| [ 0 ] |
| |
+--------+


The NFC memory is *almost* what we want, but not quite. The problems are:

1) There are gaps between the out-of-band fragments.

2) The NFC memory responds only to 16-byte or 32-byte reads and writes.

To resolve these problems, we've encapsulated the NFC memory behind these
functions:

nfc_util_copy_from_the_nfc() - Copies data to main memory from the the NFC.
nfc_util_copy_to_the_nfc() - Copies data from main memory to the NFC.

These functions don't take pointers to locations within the NFC memory - they
take a "column address." These functions know how to skip over the gaps and
handle the NFC memory such that it looks like all the data and out-of-band
bytes are completely contiguous. They also handle copying arbitrary bytes
from/to a memory that only responds to 16- or 32-byte reads/writes. If you're
accessing the NFC memory without these functions, you're *probably* doing
something wrong.


@@ -557,6 +557,7 @@ config ARCH_STMP3XXX
select GENERIC_CLOCKEVENTS
select GENERIC_GPIO
select USB_ARCH_HAS_EHCI
select ZONE_DMA
help
Support for systems based on the SigmaTel 3xxx CPUs.

0 comments on commit 7d56fb5

Please sign in to comment.
You can’t perform that action at this time.