mtd: onenand/samsung: Add device tree support

This patch adds support for instantation using Device Tree.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
mtd: onenand/samsung: Set name field of mtd_info struct

This patch adds initialization of .name field of mtd_info struct to
avoid printing "(null)" in kernel log messages, such as:

[    1.942519] 1 ofpart partitions found on MTD device (null)
[    1.949708] Creating 1 MTD partitions on "(null)":

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
ARM: dts: Add initial device tree sources for Samsung S5P6442 SoC

This patch adds basic device tree sources for S5P6442 SoC.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
ARM: dts: Add device tree sources for s5p6442-apollo board

This patch adds basic device tree sources for Samsung s5p6442-apollo
board.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
arm: configs: Add s5p6442_defconfig

This patch adds defconfig that can be used to build kernels supporting
S5P6442 SoC using Device Tree.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
mmc: sdhci-s3c: Fix local I/O clock gating

For internal card detection mechanism it is required that the local I/O
clock is always running. However while current implementation accounts
for this, it does so incorrectly leading to race conditions and warnings
about unbalanced clock disables.

This patch fixes it by inverting the logic, which now increases local
I/O clock enable count when internal card detect is used, instead of
decreasing it otherwise.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
usb: dwc2: hide some not really needed debug messages

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
clk: samsung: s5pv210: Register OF provider

The s5pv210 clock driver has not been updated after splitting OF
provider registration from samsung_clk_init(). This caused boot failure
regression on all s5pv210-based boards. This patch fixes the issue by
adding the missing call to samsung_clk_of_add_provider().

Fixes: d5e136a21b20 ("clk: samsung: Register clk provider only after
registering its all clocks")
Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
ARM: dts: s5p6442-apollo: Add Android-specific command line options

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
usb: gadget: Add Android Composite Gadget driver

The Android Gadget driver is a composite driver that allows
userspace to change at runtime the list of functions enabled in
its configuration and to configure these functions. It supports
multiple functions: acm, adb, rndis, mtp/ptp, mass storage and
accessory.

It is usually controlled by a daemon that changes the configuration
based on user settings. For example, rndis is enabled when the user
enables sharing the phone data connection and adb (Android Debug
Bridge) is only enabled when the user wants to debug applications
for security reasons.

As an example on how to use it, the following shell commands will
make the gadget disconnect from the host and make it be re-enumerated
as a composite with 1 rndis and 2 acm interfaces, and a different
product id:

echo 0       > /sys/class/android_usb/android0/enable
echo rndis,acm > /sys/class/android_usb/android0/functions
echo 2       > /sys/class/android_usb/android0/f_acm/instances
echo 2d01    > /sys/class/android_usb/android0/idProduct
echo 1       > /sys/class/android_usb/android0/enable

The driver requires a gadget controller that supports software
control of the D+ pullup and the controller driver must support
disabling the pullup during composite_bind.

Signed-off-by: Mike Lockwood <lockwood@android.com>
Signed-off-by: Benoit Goby <benoit@android.com>

Conflicts:
	drivers/usb/gadget/Kconfig
	drivers/usb/gadget/Makefile
usb: gadget: mtp: Add MTP/PTP function

USB gadget function driver used by the Android framework to
implement the MTP and PTP protocols. It creates a character device
that provides an interface for fast transfer of files and
supports transferring files greater than 4GB.

Signed-off-by: Mike Lockwood <lockwood@android.com>
usb: gadget: adb: Add ADB function

Android Debug Bridge (adb) is a command line tool that lets
users communicate with a Android-powered device. It is used
mainly to debug applications and tranfer files. f_adb implements
the transport layer between the ADB Server (on the host) and the
ADBD daemon (on the device).

Signed-off-by: Mike Lockwood <lockwood@android.com>
usb: gadget: accessory: Add Android Accessory function

USB accessory mode allows users to connect USB host hardware
specifically designed for Android-powered devices. The accessories
must adhere to the Android accessory protocol outlined in the
http://accessories.android.com documentation. This allows
Android devices that cannot act as a USB host to still interact with
USB hardware. When an Android device is in USB accessory mode, the
attached Android USB accessory acts as the host, provides power
to the USB bus, and enumerates connected devices.

Signed-off-by: Mike Lockwood <lockwood@android.com>
usb: gadget: adb: allow freezing in adb_read

wait_event_interruptible in adb_read might return -ERESTARTSYS if
userspace is frozen during adb_read or another signal is delivered
to adb.  If so, don't set dev->error to avoid resetting the adb
connection.

Change-Id: I5a7baa013a9a3a3b5305de7e6a0d18546a560018
Signed-off-by: Colin Cross <ccross@android.com>
usb: gadget: adb: do not set error flag when dequeuing req

When an ep_out req is dequeued because of userspace freezing,
don't set the error flag.

Change-Id: I680f1a1059b8ac2244aaa069e7d42dc44abf98e9
Signed-off-by: Colin Cross <ccross@android.com>
usb: gadget: adb: Only enable the gadget when adbd is ready

When adb is enabled, only connect the gadget when adbd is ready. If adbd
dies or is restarted (e.g. "adb root"), the gadget is disconnected when
the adb device is close, and it is re-connected once adb re-open the
device.

- Add callbacks to adb, similar to FunctionFs callbacks, to notify the
  gadget when the daemon is ready or closed.
- Refcount calls to android_enable/android_disable to enable the gadget
  only once all the function daemons are ready.
- Add enable/disble to android_usb_function to notify the function when
  it is added/removed from the list of enabled functions.

Change-Id: Id54ff85aec9cf8715c94b4f9bd6137a79ad58bfc
Signed-off-by: Benoit Goby <benoit@android.com>
usb: gadget: composite: Fix corruption when changing configuration

Remove the config from the configs list before releasing the spinlock.
Otherwise the other cpu might be processing a SET_CONFIGURATION that
will switch to the configuration that is being released.

Change-Id: Id4da0d0e18ead63e20cb236cd1d3e8e6d116acce
Signed-off-by: Benoit Goby <benoit@android.com>
usb: gadget: android: Fix product name

Product names may contain spaces and scanf %s only matches the 1st word.
Use strlcpy instead.

Change-Id: Ie8703fea9775f7fc17fe615a42597ca3816d36b0
Signed-off-by: Benoit Goby <benoit@android.com>
usb: gadget: android: Add FunctionFS

Add support for FunctionFS (ffs) to implement usb functions in userspace.

The aliases property stores the list of functions that are implemented
using functionfs.

For example:
echo "adb,mtp" > /sys/class/android_usb/android0/f_ffs/aliases

Then when the function are enabled:
echo "adb,acm" > /sys/class/android_usb/android0/functions
Internally, ffs and acm will be used.

Change-Id: I44117b183d48a5a99ddbee3ef2cf8998be74598e
Signed-off-by: Benoit Goby <benoit@android.com>
usb: gadget: accessory: Fix section mismatch

create_bulk_endpoints should not be __init since it is called when
accessory is enabled

Change-Id: If827a4531f0f6c15af938345163923186368e2a5
Signed-off-by: Benoit Goby <benoit@android.com>