arch : arm : modem_if: change lte power gpio init value and mux framework

* use standard mux framework of LTE
* Change LTE_OFF gpio default value from 0 to 1
to avoid leakage before LTE power on.

Change-Id: I34afde03bf68bb1e04d817f16e6fda3fdc6e792e
Signed-off-by: dongjinseo <dejay.seo@samsung.com>
toro: modem_if: board: Added mux setting for pda and phone active gpio.

Added PDA and Phone active pin mux settings for control.
These will be controlled by dpram link and cbp71 modem ctrl driver.

Change-Id: Ifa707639c606787caf49734019cfa516281bae0e
Signed-off-by: j.h.hyun <j.h.hyun@samsung.com>
misc: modem_if: Add CP Ramdump io-devices in board file

1. Add umts_ramdump0 for HSPA modem.
2. Add cdma_ramdump0 for CDMA modem.
3. Add lte_ramdump0 for LTE modem.
	- all io-devices need 'radio' permission

Change-Id: I427d0737790d837a995c8f91b663649af0db9349
Signed-off-by: wonhee <wonhee48.seo@samsung.com>
ARM: omap4: tuna: Pass VIA_PS_HOLD gpio to the modem driver

Setting VIA_PS_HOLD low after boot reduces inactive power
by 16 mA.

Change-Id: I761b1b04809a5227215a6c253585caa522ea845d
Signed-off-by: p5397.park <p5397.park@samsung.com>
modem_if: usb_link: Set host_actve gpio.

* Set host_active gpio value high when gpio init.
* LTE modem decided booting mode(dump/normal) by host_active gpio.
* So, We need to get host_active gpio high when gpio init time.

Change-Id: I8df0fb185f02efb6f83aaae2d37a2258a3142246
Signed-off-by: denis.choi <denis.choi@samsung.com>
ARM: tuna: Update platform_data for dpram driver

Use one resource for the whole dpram

Change-Id: I6009a998b7f6725573e41646ffc3c38030d3236c
Signed-off-by: Benoit Goby <benoit@android.com>
modem_if: usb_link: Control Slave wake up GPIO when system resume

We need to check 'host_wake_up'(HWU) gpio status before
set 'slave_wake_up'(SWU)gpio high when system resume.
When system resume, we set SWU high. but some times, HWU already high
so there are mismatch handshaking happend.
We don't set SWU high if HWU is already high.

Change-Id: I6f1fc2344b0723a1d0d539791fd873df474903a8
Signed-off-by: denis.choi <denis.choi@samsung.com>
modem_if: cdma: Set gpio_cp_off control on cbp71_on

gpio_cp_off pin is needed to control when reset CDMA.

Change-Id: I89236e38477d7cde8a15cd01f5f4e2a1d409d1b1
Signed-off-by: j.h.hyun <j.h.hyun@samsung.com>
modem_if: Free the phone_active irq on shutdown

This prevents from the risk of having shutdown locked by
an interrupt storm.

Change-Id: I83973ed35d682794d63cd6b0e47e2bd74e982d31
Signed-off-by: Benoit Goby <benoit@android.com>
misc: modem_if: io_device: Prevent to call misc_read continuously without any data

1. Change modem state when crash happen.
	- change modem state to 'STATE_OFFLINE' after RIL read state
	- not to send modem state to application again
2. Use 'printk_ratelimited' instead of 'pr_err'.
3. Roll back num 1. - patch set 2.
	- we don't need STATE_RESET, only use STATE_EXIT
4. Add more info log about HDLC error.

Change-Id: Ice5c174c64f2297ca756dd7b0acd0d4f30a86f6b
Signed-off-by: wonhee <wonhee48.seo@samsung.com>
modem_if: usb_link: change urb rx size to 4KB

512Byte urb size is way too small, causing to many urb completions.
4KB seems to be a reasonable size.

Change-Id: I692f3bb39bdc7416fdc815c5b777b0d6a3f4d4a4
Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
modem_if: Remove STATE_MODEM_RESET

We don't need 2 crashed states, we now decide to take a ramdump or not
based on the "persist.radio.ramdump" property

Change-Id: I1686e514dae871da9378bbdf1d72aab06ffe79f6
Signed-off-by: Benoit Goby <benoit@android.com>
modem_if: usb_link: update time-stamp for dev before auto-suspend

Refresh the time-stamp for the dev for auto-suspend attempt.
With this change, after the Modem de-asserts CP-WAKE GPIO,
500ms are given to USB to suspend the port.

This time should be enough for remainder of the RFS(32KB size)
to be received by the AP.

Change-Id: I192cb5f0b68e080bc0ad1500c269e0006d716dbc
Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
modem_if: usb_link: Support silent reset when dumpmode on / off

At this time, Dump mode set in google keystring
So kernel also need to support it
I seperate a cmc reset operation when reset for dump mode
I test for 6 case -
debug on mode - ril request, kernel request, LTE crash
debug off mode - ril request, kernel request, LTE crash
It works well about each case.

Change-Id: I4429e5bc3e169b869719b5f47b26abfaed65d76e
Signed-off-by: denis.choi <denis.choi@samsung.com>
modem_if: usb_link: Process urbs that complete with status -ENOENT

usb_kill_urb makes urbs complete with status -ENOENT. But some urbs
may already have received data. Process them in this case but don't
re-submit them.

Change-Id: Iba5053104cd858e15f02b6bbd9aa32353540969d
Signed-off-by: Benoit Goby <benoit@android.com>
misc: modem_if: Remove adding useless packet size

1. Remove useless alloc packet size in boot mode.
	- HDLC and header
2. Add only header length for align transaction. - patch set 2

Change-Id: I2eddffd705153fb487e300ca9fe82eb1a7496de3
Signed-off-by: wonhee <wonhee48.seo@samsung.com>
modem_if: usb_link: avoid urb deletion race

In case of silent reset or modem re-enumerations,
if_usb_disconnect calls usb_free_urbs()

Make sure that the DMA buffer urb->trasnfer_dma is not
freed before the urb is unlined from HCD.

Otherwise the qtd schdules may continue to write to the
dma pointer even though it does not exist.

This can lead to errors:
[   41.939727] WARNING: at arch/arm/mach-omap2/omap_l3_noc.c:129 l3_interrupt_handler+0xe4/0x380()
[   41.948913] L3 standard error: SOURCE:ABE at address 0xc60

Change-Id: Ibc5784ff372f795ea4887ae9db7358daa974670e
Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
modem_if: usb_link: fix race of suspend and rx-submit

An urb completion can happen in middle of if_usb_suspend.
For such an URB, status == 0 and should not be re-submitted since
usb_kill_anchored_urbs() is in the process of killing all 'reading' URBs.

So check if suspend handler has alredy been called, then put the rx urb in
the 'urbs' anchor so that it can be resumed on if_usb_resume.

This race leads to error of wrong address going to EHCI and resulting in:
[  232.273712] WARNING: at arch/arm/mach-omap2/omap_l3_noc.c:129 l3_interrupt_handler+0xe4/0x380()
[  232.284118] L3 standard error: SOURCE:ABE at address 0xd20

Change-Id: I6013fd0ecd532805a55ef4f5c24181c67dad9451
Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
modem_if: usb_link: disallow AP2LTE tx and gpio handshaking if usb is not ready

* Another tx comes during modem silent reset or re-enumuration,
host_wake_time problem and CRASH_EXIT event occurs repetedly.
* Disallow AP2LTE tx and gpio handshaking at below conditions.
	- usbdev not exist
	- usbdev->state is no-attached(disconnected)
	- host wake timeout caused CRASH_EXIT

Signed-off-by: dongjinseo <dejay.seo@samsung.com>

Change-Id: I9fb4b8db9d531b6ad1a413c9c9c36c6b7ec147ee
Signed-off-by: dongjinseo <dejay.seo@samsung.com>
modem_if: usb_link: purge sk_fmt_tx_q at the start of LTE flashless boot

* IPC_BOOT and IPC_FMT use same sk_fmt_tx_q, so LTE modem boot fails after silent reset if there remains data at sk_fmt_tx_q.
* purge sk_fmt_tx_q at the start of LTE flashless boot.
* print return value if usb_tx_urb_with_skb fails for AP2LTE tx debugging.

Change-Id: I21b68aedbc6210979c87eb496d87f55481b20b44
Signed-off-by: dongjinseo <dejay.seo@samsung.com>