Commit Graph

211225 Commits

Author SHA1 Message Date
Benoit Goby
288b58e155 usb: gadget: Fix tegra udc in OTG mode
Check the transceiver state before checking udc->stopped
Enable/disable the PHY and the clock on cable events

Change-Id: Id5a8a1b94f83da8060786f31181014dd1d546fc7
Signed-off-by: Benoit Goby <benoit@android.com>
2010-10-06 16:27:16 -07:00
Benoit Goby
2e39427ef6 usb: host: Add EHCI driver for NVIDIA Tegra SoCs
Change-Id: I53c560f2c31e043f139b840f58786429ded6ec62
Signed-off-by: Benoit Goby <benoit@android.com>
2010-10-06 16:27:15 -07:00
Benoit Goby
b2d28cdbf3 [ARM] tegra: usb_phy: Add tegra_usb_phy_power_off
Change-Id: If4d66b1a0f1810773b9dc9bcec0e252df947e609
Signed-off-by: Benoit Goby <benoit@android.com>
2010-10-06 16:27:15 -07:00
Gary King
0b00f73157 [ARM] tegra: harmony/ventana: register additional devices
register GART, pda_power, and OTG devices

Change-Id: I6dec5f765494cdc96f3395cf32fd962c87bf70b7
Signed-off-by: Gary King <gking@nvidia.com>
2010-10-06 16:27:14 -07:00
Gary King
7c1fc9071b [ARM] tegra: ventana: add initial support for Ventana
Change-Id: I1993fda7628c623d53fd2c97649ec3533ad790e2
Signed-off-by: Gary King <gking@nvidia.com>
2010-10-06 16:27:13 -07:00
Gary King
b2cc83b164 [ARM] tegra: harmony: add sdhci0 controller (wlan)
Change-Id: I6000b1d34e35d9291cae80e4508518d0059397f8
Signed-off-by: Gary King <gking@nvidia.com>
2010-10-06 16:27:12 -07:00
Colin Cross
7ab7a5e6ac [ARM] tegra: suspend: Add iovmm suspend
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:27:11 -07:00
Gary King
72868d880e [ARM] tegra: add I/O virtual memory manager interface (iovmm)
The Tegra IOVMM is an interface to allow device drivers and subsystems in
the kernel to manage the virtual memory spaces visible to I/O devices.

The interface has been designed to be scalable to allow for I/O virtual
memory hardware which exists in one or more limited apertures of the address
space (e.g., a small aperture in physical address space which can perform
MMU-like remapping) up to complete virtual addressing with multiple
address spaces and memory protection.

The interface has been designed to be similar to the Linux virtual memory
system; however, operations which would be difficult to implement or
nonsensical for DMA devices (e.g., copy-on-write) are not present, and
APIs have been added to allow for management of multiple simultaneous
active address spaces.

The API is broken into four principal objects: areas, clients, domains and
devices.

Areas
=====

An area is a contiguous region of the virtual address space which can be
filled with virtual-to-physical translations (and, optionally, protection
attributes). The virtual address of the area can be queried and used for
DMA operations by the client which created it.

As with the Linux vm_area structures, it is the responsibility of whichever
code creates an area to ensure that it is populated with appropriate
translations.

Domains
=======

A domain in the IOVMM system is similar to a process in a standard CPU
virtual memory system; it represents the entire range of virtual addresses
which may be allocated and used for translation. Depending on hardware
capabilities, one or more domains may be resident and available for
translation. IOVMM areas are allocated from IOVMM domains.

Whenever a DMA operation is performed to or from an IOVMM area, its parent
domain must be made resident prior to commencing the operation.

Clients
=======

I/O VMM clients represent any entity which needs to be able to allocate
and map system memory into I/O virtual space. Clients are created by name
and may be created as part of a "share group," where all clients created
in the same share group will observe the same I/O virtual space (i.e., all
will use the same IOVMM domain). This is similar to threads inside a process
in the CPU virtual memory manager.

The callers of the I/O VMM system are responsible for deciding on the
granularity of client creation and share group definition; depending on the
specific usage model expected by the caller, it may be appropriate to create
an IOVMM client per task (if the caller represents an ioctl'able interface
to user land), an IOVMM client per driver instance, a common IOVMM client
for an entire bus, or a global IOVMM client for an OS subsystem (e.g., the DMA
mapping interface).

Each client is responsible for ensuring that its IOVMM client's translation is
resident on the system prior to performing DMA operations using the IOVMM
addresses. This is accomplished by preceding all DMA operations for the client
with a call to tegra_iovmm_client_lock (or tegra_iovmm_client_trylock),
and following all operations (once complete) with a call to
tegra_iovmm_client_unlock. In this regard, clients are cooperatively context-
switched, and are expected to behave appropriately.

Devices
=======

I/O VMM devices are the physical hardware which is responsible for performing
the I/O virtual-to-physical translation.

Devices are responsible for domain management: the mapping and unmapping
operations needed to make translations resident in the domain (including
any TLB shootdown or cache invalidation needed to ensure coherency), locking
and unlocking domains as they are made resident by clients into the devices'
address space(s), and allocating and deallocating the domain objects.

Devices are responsible for the allocation and deallocation of domains to
allow coalescing of multiple client share groups into a single domain. For
example, if the device's hardware only allows a single address space to
be translated system-wide, performing full flushes and invalidates of the
translation at every client switch may be prohibitively expensive. In these
circumstances, a legal implementation of the IOVMM interface includes
returning the same domain for all clients on the system (regardless of
the originally-specified share group).

In this respect, a client can be assured that it will share an address space
with all of the other clients in its share group; however, it may also share
this address space with other clients, too.

Multiple devices may be present in a system; a device should return a NULL
domain if it is incapable of servicing the client when it is asked to
allocate a domain.

----------------------------------------------------------------------------

IOVMM Client API
================

tegra_iovmm_alloc_client - Called to create a new IOVMM client object; the
 implementation may create a new domain or return an existing one depending on
 both the device and the share group.

tegra_iovmm_free_client - Frees a client.

tegra_iovmm_client_lock - Makes a client's translations resident in the IOVMM
 device for subsequent DMA operations. May block if the device is incapable
 of context-switching the client when it is called. Returns -EINTR if the
 waiting thread is interrupted before the client is locked.

tegra_iovmm_client_trylock - Non-blocking version of tegra_iovmm_client_lock

tegra_iovmm_client_unlock - Called by clients after DMA operations on IOVMM-
 translated addresses is complete; allows IOVMM system to context-switch the
 current client out of the device if needed.

tegra_iovmm_create_vm - Called to allocate an IOVMM area. If
 lazy / demand-loading of pages is desired, clients should supply a pointer
 to a tegra_iovmm_area_ops structure providing callback functions to load, pin
 and unpin the physical pages which will be mapped into this IOVMM region.

tegra_iovmm_get_vm_size - Called to query the total size of an IOVMM client

tegra_iovmm_free_vm - Called to free a IOVMM area, releasing any pinned
 physical pages mapped by it and to decommit any resources (memory for
 PTEs / PDEs) required by the VM area.

tegra_iovmm_vm_insert_pfn - Called to insert an exact pfn (system memory
 physical page) into the area at a specific virtual address. Illegal to call
 if the IOVMM area was originally created with lazy / demand-loading.

tegra_iovmm_zap_vm - Called to mark all mappings in the IOVMM area as
 invalid / no-access, but continues to consume the I/O virtual address space.
 For lazy / demand-loaded IOVMM areas, a zapped region will not be reloaded
 until it has been unzapped; DMA operations using the affected translations
 may fault (if supported by the device).

tegra_iovmm_unzap_vm - Called to re-enable lazy / demand-loading of pages
 for a previously-zapped IOVMM area.

tegra_iovmm_find_area_get - Called to find the IOVMM area object
 corresponding to the specified I/O virtual address, or NULL if the address
 is not allocated in the client's address space. Increases the reference count
 on the IOVMM area object

tegra_iovmm_area_get - Called to increase the reference count on the IOVMM
 area object

tegra_iovmm_area_put - Called to decrease the reference count on the IOVMM
 area object

IOVMM Device API
================

tegra_iovmm_register - Called to register a new IOVMM device with the IOVMM
 manager

tegra_iovmm_unregister - Called to remove an IOVMM device from the IOVMM
 manager (unspecified behavior if called while a translation is active and / or
 in-use)

tegra_iovmm_domain_init - Called to initialize all of the IOVMM manager's
 data structures (block trees, etc.) after allocating a new domain

IOVMM Device HAL
================

map - Called to inform the device about a new lazy-mapped IOVMM area. Devices
 may load the entire VM area when this is called, or at any time prior to
 the completion of the first read or write operation using the translation.

unmap - Called to zap or to decommit translations

map_pfn - Called to insert a specific virtual-to-physical translation in the
 IOVMM area

lock_domain - Called to make a domain resident; should return 0 if the
 domain was successfully context-switched, non-zero if the operation can
 not be completed (e.g., all available simultaneous hardware translations are
 locked). If the device can guarantee that every domain it allocates is
 always usable, this function may be NULL.

unlock_domain - Releases a domain from residency, allows the hardware
 translation to be used by other domains.

alloc_domain - Called to allocate a new domain; allowed to return an
 existing domain

free_domain - Called to free a domain.

Change-Id: Ic65788777b7aba50ee323fe16fd553ce66c4b87c
Signed-off-by: Gary King <gking@nvidia.com>
2010-10-06 16:27:10 -07:00
Benoit Goby
d80e1484da usb: gadget: Use USB PHY api
Signed-off-by: Benoit Goby <benoit@android.com>
2010-10-06 16:27:09 -07:00
Benoit Goby
fb00b2dc07 [ARM] tegra: add API for enabling the USB PHYs
Moved usb phy initialization code
Added support for usb3 utmi phy
Updated the registers as recommended by Nvidia to be MUCH closer to passing the integrity tests
TODO: Add support for usb2 ulpi phy

Signed-off-by: Benoit Goby <benoit@android.com>
2010-10-06 16:27:09 -07:00
Gary King
a1df55a17b [ARM] tegra: harmony: remove hard-coded partition table
use the partition information provided on the kernel command line rather
than a fixed table that is subject to change.

Change-Id: I650f634bf49b8658debb75535e94f2a497ef3432
Signed-off-by: Gary King <gking@nvidia.com>
2010-10-06 16:27:08 -07:00
Gary King
59a37210b7 mtd/tegra_nand: don't ignore return value for add_mtd_partitions
when the mtd partition command line format is used, ignoring the
return value left err set to the number of partitions, which was
later interpreted as an error return code for tegra_nand_probe,
which caused the MTD master to be unregistered (ultimately causing
NULL pointer derefs when mounting the root partition).

Change-Id: Icebfb295810554617c56deeafc91bc22cc43bb35
Signed-off-by: Gary King <gking@nvidia.com>
2010-10-06 16:27:07 -07:00
Colin Cross
8dda411501 [ARM] tegra: harmony: Make board init calls explicit
Signed-off-by: Colin Cross <ccross@android.com>
Change-Id: Ic14e8db00f2272de2f4ee4013bb3ab5c1951e7fe
2010-10-06 16:27:06 -07:00
Colin Cross
2105cda31e [ARM] tegra: harmony: Add framebuffer platform device
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:27:05 -07:00
Colin Cross
e65aa947ee [ARM] tegra: harmony: Remove android platform devices
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:27:04 -07:00
Benoit Goby
0e06e44e33 usb: gadget: Add support for OTG
Based on work by Nvidia

Signed-off-by: Benoit Goby <benoit@android.com>
2010-10-06 16:27:03 -07:00
Andrei Warkentin
6fb715de6a w1: master: tegra_w1: Adds generic mach-tegra w1 support.
This adds w1 as a device for mach-tegra boards, fixes wrong
OWR I/O base, and changes OWR clock name.

Change-Id: Idffbdbd05f383ce8e423ee301e197e230db4f2f9
Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
2010-10-06 16:27:03 -07:00
Andrei Warkentin
366a15f41d w1: master: tegra_w1: Add initial Tegra W1 master driver
Initial implementation of W1 master driver for Tegra SoCs.
Tested with DS2781 slave driver.

Change-Id: I6cda1ea152d25a789ae6cdca96b710da72884033
Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
2010-10-06 16:27:02 -07:00
Gary King
542755067b [ARM] tegra: add a header defining tegra 2 wake pads
wakeup from LP0 is latched at the pads rather than in the interrupt
controller; since the pad numbers don't correspond to any other
sane numbering or naming system, provide a new list of defines
to make board code easier to read and maintain

Change-Id: Icf85a5826acc567452c0a2475c5a06ed042f66b3
Signed-off-by: Gary King <gking@nvidia.com>
2010-10-06 16:27:01 -07:00
Colin Cross
8c791331b0 [ARM] tegra: enable ARM errata 742230
Change-Id: I25b9e7c266147163ca1dcf7619db0580ff9888d8
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:27:00 -07:00
Colin Cross
29860b621f video: tegrafb: Enable host1x clock
Change-Id: If1e50ed661493cb06de5e5bbc5ee2b0966297b4f
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:59 -07:00
Iliyan Malchev
5bc9b44704 [ARM] tegra: add FIQ support
Signed-off-by: Iliyan Malchev <malchev@google.com>
2010-10-06 16:26:58 -07:00
Colin Cross
d0fe0d3b06 [ARM] tegra: Move common platform_device_register into boards
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:57 -07:00
Erik Gilling
28f5ece8ff [ARM] tegra: add spi platform devices
Signed-off-by: Erik Gilling <konkers@android.com>
2010-10-06 16:26:57 -07:00
Colin Cross
3d2352d98f [ARM] tegra: delay: Use immediates instead of literals
Change-Id: I4629398863062e3f80303c84d0fd3b7a4ed6e708
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:56 -07:00
Colin Cross
76f3a19c08 [ARM] tegra: Add arch-specific udelay using TMRUS
Change-Id: If075117642a725ee2ee24a622068274e588a5bc1
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:55 -07:00
Colin Cross
8734cdc2da [ARM] Add ARCH_PROVIDES_UDELAY config option
Change-Id: Ife690c9d055fc0f17a52d2b29048af5062a664a6
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:54 -07:00
Colin Cross
7454dd5c33 [ARM] tegra: tegrafb: Free irq in probe error case and remove function
v3: Fixes from review by Jaya Kumar
        - Free irq in probe error case and remove function

Change-Id: Id6ebb8b79a738d0e3a9ac63fddd785f5652982f7
CC: Jaya Kumar <jayakumar.lkml@gmail.com>
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:53 -07:00
Colin Cross
d4ad018f1e [ARM] tegra: Add framebuffer driver
v2: Fixes from review by Russell King
    - Use proper return values

v2: Fixes from review by Jaya Kumar
    - Comments on lcd resolution
    - Remove stub functions
    - Change DUMP_REG to pr_debug
    - Add unregister_framebuffer to tegra_plat_remove

v2: from Colin Cross
    - adjust debugging

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
2010-10-06 16:26:52 -07:00
Erik Gilling
edad4bb437 [ARM] tegra: move sdhci and i2c to generic devices.c
Change-Id: Ib8d500cb868663d851af5e849815bc2a1312f659
Signed-off-by: Erik Gilling <konkers@android.com>
2010-10-06 16:26:51 -07:00
Todd Poynor
1104d84f0f tegra: i2c: recover from spurious interrupt storm
Re-init the I2C controller when an IRQ arrives with no
I2C_INT_STATUS bits set to indicate why the interrupt was sent.
Storms of such mystery interrupts are infrequently seen.

Dump some more status when these interrupts arrive.  Set an error
for the current request and wake up the requester (rather than
timing out the request or possibly silently ignoring the interrupts).

If the I2C block is inside the DVC, also ACK the DVC I2C transfer
done interrupt in the ISR error return path, as is done for the
normal return path.

Change-Id: I625b5c245aa8d83dbd7ff076b0fb5cc5682fffa1
Signed-off-by: Todd Poynor <toddpoynor@google.com>
2010-10-06 16:26:51 -07:00
Colin Cross
90905b950e i2c: tegra: Add reset in init back
The tegra i2c controller requires a reset after an error.  Put the
reset back in the init function.

Signed-off-by: Colin Cross <ccross@google.com>
2010-10-06 16:26:50 -07:00
Colin Cross
df982ed58c i2c: tegra: Remove reset during init 2010-10-06 16:26:49 -07:00
Colin Cross
105220b5a0 i2c: i2c-tegra: Fix warning
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:48 -07:00
Colin Cross
1cd4734b9c i2c: i2c-tegra: Fix checkpatch issues, remove debugging
Change-Id: Icba24ebb1753619fcb039cbcf98487627f274744
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:47 -07:00
Gary King
67b5a6542f i2c-tegra: add support for virtual busses with dynamic pinmuxing
this adds support for dynamically reprogramming the I2C controller's
pin mux on transaction boundaries to enable one controller to be
registered as multiple I2C bus adapters with the kernel. this allows
platform designers an additional tool to resolve clock rate, I/O
voltage and electrical loading restrictions between the platform's
peripherals.

the i2c-tegra platform data is extended to support this; platforms
which use this feature should pass in the number of busses which
should be created for each controller, the starting adapter number
to use and the clock rate and pin mux for each virtual bus.

Change-Id: I57a96deb7b7b793222ec3f8cc3a941917a023609
Signed-off-by: Gary King <gking@nvidia.com>
2010-10-06 16:26:46 -07:00
Colin Cross
1908b3377d i2c: tegra: Prevent i2c transactions after suspend
The cpufreq driver suspends very late, and may cause an i2c
transaction when the clk api calls the dvfs api, which calls
the regulator api, which calls i2c.  Return an error if an
i2c transaction is requested after suspend has been called.

Change-Id: I4d92eb9c1f558758097e2dafda6fc02addf4e185
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:45 -07:00
Colin Cross
80f33a8c5a i2c: busses: i2c-tegra: Set bus speed in platform data
Change-Id: Iebc1ad5cc56d09f1df99d09dd6456c24c93cdb0b
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:44 -07:00
Colin Cross
91e3654c23 i2c: busses: i2c-tegra: Fix bus clock rate
Change-Id: I186a7b7474c3d2504e2a4d7c1308706bb1b53004
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:43 -07:00
Colin Cross
b9f90a825e [ARM] tegra: i2c: Fix i2c driver behavior on timeout/nack
Change-Id: Ia0968df649fa56d93cf3522d983fde16413e854d
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:42 -07:00
Colin Cross
4f46fcca79 [ARM] tegra: i2c: Disable clock when idle, fix dvc
Change-Id: Idca4c392134640f611ccf10edfd28fea102742fb
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:41 -07:00
Colin Cross
cb07c1bf90 [ARM] tegra: Add i2c support
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:40 -07:00
Erik Gilling
9285c27155 usb: gadget: add utmip phy into to fsl_tegra_udc
Signed-off-by: Erik Gilling <konkers@android.com>
2010-10-06 16:26:39 -07:00
Colin Cross
a8ba61048e [ARM] tegra: HACK Enable uart and clocks in uncompress.h
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:38 -07:00
Erik Gilling
4bfc0da441 [ARM] tegra: add platform devices to harmony board file
Signed-off-by: Erik Gilling <konkers@android.com>
2010-10-06 16:26:38 -07:00
Colin Cross
2466e23b7e [ARM] tegra: harmony: Add sdhci devices
Change-Id: I29eab117c3fb237d5178d9fcf065563e656d46f2
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:37 -07:00
Colin Cross
8ce033fd1f usb: gadget: fsl_udc: wmb ep_td struct when submitting to controller
Since these get allocated dmacoherent instead of noncacheable in armv7, we need
to do wmb before handing them to hardware.

Change-Id: I413eeb6da3bfeb754c4b475b19fe5823d83d3d04
Signed-off-by: Colin Cross <ccross@android.com>
Cc: Erik Gilling <konkers@android.com>
2010-10-06 16:26:36 -07:00
Erik Gilling
fd9c8bc964 usb: gadget: add preliminary Tegra support to fsl driver
Based on work by Gary King.

Further abstraction of the chipidea core support needs to be done.

Signed-off-by: Colin Cross <ccross@android.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Gary King <GKing@nvidia.com>
2010-10-06 16:26:35 -07:00
Colin Cross
67c83e26d0 [ARM] mtd: NVIDIA Tegra NAND controller driver.
Change-Id: I6f0b18c5621bcf8fb6cde8e7b05828075db72594
CC: Dima Zavin <dima@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
2010-10-06 16:26:34 -07:00
Gary King
1994d98dc3 [ARM] tegra: smp: add barrier before raising GIC IPI IRQ
since the GIC registers are device memory and the IPI data is
stored in normal memory, a simple dmb is insufficient to ensure
that the data will be visible to the IPI-receiving processor
prior to the IPI handler running

Change-Id: Idaddd9f225d00ebd3a8d656fa75c401323b80138
Signed-off-by: Gary King <gking@nvidia.com>
2010-10-06 16:26:33 -07:00