usage:
To disable console:
echo 0 > /sys/devices/platform/msm_serial_hsl.0/console
To enable console:
echo 1 > /sys/devices/platform/msm_serial_hsl.0/console
To see the status of console:
cat /sys/devices/platform/msm_serial_hsl.0/console
Change-Id: I3fe188cd18429641de8e48075f37a1729a36d80b
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Both tx and rx command_ptr_ptr are of type u32*. While allocating
memory for it, sizeof(u32 *) is used as part of kmalloc API instead
of sizeof(u32). ADM Hardare requires size of command_ptr_ptr as 1 Word.
Both sizeof(u32 *) and sizeof(u32) are same on 32-bit architecture
whereas sizeof(u32 *) would be different in size compare to sizeof(u32)
on anyother architecture.
Hence correct usage of sizeof(command_ptr_ptr) for Tx and Rx with
kmalloc and dma_(map/unmap)_single APIs.
Change-Id: I668146693b3a76d3eef0d8c9f8cebae582f15c05
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Call pm_runtime_disable() function outside spin clock to
fix "sleeping function called from invalid context" bug.
Change-Id: I964ca09b1f8b1a984736df6b6d72d4b6cd6aed1e
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* common/android-3.0: (570 commits)
misc: remove kernel debugger core
ARM: common: fiq_debugger: dump sysrq directly to console if enabled
ARM: common: fiq_debugger: add irq context debug functions
net: wireless: bcmdhd: Call init_ioctl() only if was started properly for WEXT
net: wireless: bcmdhd: Call init_ioctl() only if was started properly
net: wireless: bcmdhd: Fix possible memory leak in escan/iscan
cpufreq: interactive governor: default 20ms timer
cpufreq: interactive governor: go to intermediate hi speed before max
cpufreq: interactive governor: scale to max only if at min speed
cpufreq: interactive governor: apply intermediate load on current speed
ARM: idle: update idle ticks before call idle end notifier
input: gpio_input: don't print debounce message unless flag is set
net: wireless: bcm4329: Skip dhd_bus_stop() if bus is already down
net: wireless: bcmdhd: Skip dhd_bus_stop() if bus is already down
net: wireless: bcmdhd: Improve suspend/resume processing
net: wireless: bcmdhd: Check if FW is Ok for internal FW call
tcp: Don't nuke connections for the wrong protocol
ARM: common: fiq_debugger: make uart irq be no_suspend
net: wireless: Skip connect warning for CONFIG_CFG80211_ALLOW_RECONNECT
mm: avoid livelock on !__GFP_FS allocations
...
Conflicts:
arch/arm/mm/cache-l2x0.c
arch/arm/vfp/vfpmodule.c
drivers/mmc/core/host.c
kernel/power/wakelock.c
net/bluetooth/hci_event.c
Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
This change to increase the RxStale timeout is temporary
until the correct BCR register support is available in
the simulator model.
Change-Id: Ibd307d65ebf9093dd1ff6b16eb35f8515f708324
Signed-off-by: Sathish Ambley <sambley@codeaurora.org>
Support to retrieve iomem resources by name does not currently
exist in device tree, access these by index until support for
this comes in.
Clocks are still queried by direct name from the driver until
device tree clock support is implemented.
Change-Id: I6e4e7d7968573959f652abb950729b851fe491b8
Signed-off-by: Sathish Ambley <sambley@codeaurora.org>
Add check to avoid dereferencing NULL Pointer in serial drivers where
retrieving of resource may fail.
CRs-Fixed: 313390
Change-Id: I4a64039ea33c39a5e1853b2d52a26140ae080d5b
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
This patch fixes following issues:
1. typecast unsigned int variable (irq) to integer
compare with zero.
2. Intializing baud variable
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
This patch fixes following issues:
1. Using snprintf instead of sprintf(deprecated api)
2. Typecast unsigned int variable (irq) to integer
to compare with zero.
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Currently spin_lock() and spin_unlock() apis are used while handling
interrupts for synchronization which may create deadlock or schedule
out current interrupt processing part if any other interrupt comes on
the same cpu. Hence use spin_lock_irqsave() and spin_lock_irqrestore()
apis to make driver smp-safe.
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
msm_hs_config_port function acquires spinlock before calling
msm_hs_request_port function where it calls request_mem_region to
claim gsbi resource and ioremap the same. As request_mem_region calls
kmem_cache_alloc which can sleep, enabling CONFIG_DEBUG_SPINLOCK_SLEEP
shows below stacktrace complaining about sleeping in invalid context.
BUG: sleeping function called from invalid context at mm/slub.c:795
in_atomic(): 1, irqs_disabled(): 128, pid: 1, name: swapper
INFO: lockdep is turned off.
irq event stamp: 52269
hardirqs last enabled at (52268): kmem_cache_free+0xc8/0xd8
hardirqs last disabled at (52269): _raw_spin_lock_irqsave+0x18/0x5c
softirqs last enabled at (49209): irq_exit+0x54/0xa8
softirqs last disabled at (49192): irq_exit+0x54/0xa8
(unwind_backtrace+0x0/0x124) from (kmem_cache_alloc+0x3c/0xf0)
(kmem_cache_alloc+0x3c/0xf0) from (__request_region+0x64/0x150)
(__request_region+0x64/0x150) from (msm_hs_request_port+0x4c/0x9c)
(msm_hs_request_port+0x4c/0x9c) from (msm_hs_config_port+0x2c/0x78)
(msm_hs_config_port+0x2c/0x78) from (uart_add_one_port+0x144/0x370)
(uart_add_one_port+0x144/0x370) from (msm_hs_probe+0x5c8/0x678)
(msm_hs_probe+0x5c8/0x678) from (platform_drv_probe+0x18/0x1c)
(platform_drv_probe+0x18/0x1c) from (driver_probe_device+0x140/0x254)
(driver_probe_device+0x140/0x254) from (__driver_attach+0x68/0x8c)
(__driver_attach+0x68/0x8c) from (bus_for_each_dev+0x44/0x74)
(bus_for_each_dev+0x44/0x74) from (bus_add_driver+0xc8/0x254)
(bus_add_driver+0xc8/0x254) from (driver_register+0xa8/0x134)
(driver_register+0xa8/0x134) from (platform_driver_probe+0x18/0x8c)
(platform_driver_probe+0x18/0x8c) from (msm_serial_hs_init+0x68/0xc8)
(msm_serial_hs_init+0x68/0xc8) from (do_one_initcall+0xc8/0x1a0)
(do_one_initcall+0xc8/0x1a0) from (kernel_init+0x150/0x218)
(kernel_init+0x150/0x218) from (kernel_thread_exit+0x0/0x8)
This change fixes the above mentioned issue.
CRs-Fixed: 307667
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
The crci conflict checking code was designed for a system where a crci's
mux could be changed at runtime. In reality, our chips configure these
statically, so it is not necessary.
Signed-off-by: Jeff Ohlstein <johlstei@codeaurora.org>
UART Core clock set rate is getting called before actually disabling uart
core clock. This problem has been seen with console suspend due to setting
clock rate to zero from msm_hsl_power api. This change makes sure that uart
core clock is actually disabled before it is set to zero.
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Drivers should now use their device names to distinguish between
clocks of the same type rather than the clock name.
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Enable the GSBI bus clock when calling uart_add_one_port in
the probe function to allow a clean transition from the
early console to the regular console. The TTY layer may try
to configure the port before the early console became
deactivated, which will prematurely disable the clocks and
cause a lockup.
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
MR1 register (AUTO_RFR_LEVEL) programming value is considered in
Words for UARTDM Core, whereas it is considered in Bytes for UART
Core. Currently MR1 register is programmed for AUTO_RFR_LEVEL value
as 3/4 size of Rx FIFO size i.e. 48 Bytes. For UARTDM Core this
value needs to configure into Words. Hence programme AUTO_RFR_LEVEL
value using MR1 register as 12 instead of 48.
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Allow modem status bits like RI, DSR and CTS in tiocmset. TTY drivers,
for example USB function serial driver, which talks to DCE on behalf
DTE and running in DCE are interested in these bits.
CRs-fixed: 300912
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
RFWR register's programming value is considered in Words for UARTDM
Core, whereas it is considered in Bytes for UART Core. Currently RFWR
register is programmed as 3/4 size of Rx FIFO size i.e. 48 Bytes.
For UARTDM Core this value needs to configure into Words. Hence programme
RFWR register with value as 12 instead of 48.
CRs-Fixed: 301603
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
commit 24d406a6bf736f7aebdc8fa0f0ec86e0890c6d24 upstream.
tty_operations->remove is normally called like:
queue_release_one_tty
->tty_shutdown
->tty_driver_remove_tty
->tty_operations->remove
However tty_shutdown() is called from queue_release_one_tty() only if
tty_operations->shutdown is NULL. But for pty, it is not.
pty_unix98_shutdown() is used there as ->shutdown.
So tty_operations->remove of pty (i.e. pty_unix98_remove()) is never
called. This results in invalid pty_count. I.e. what can be seen in
/proc/sys/kernel/pty/nr.
I see this was already reported at:
https://lkml.org/lkml/2009/11/5/370
But it was not fixed since then.
This patch is kind of a hackish way. The problem lies in ->install. We
allocate there another tty (so-called tty->link). So ->install is
called once, but ->remove twice, for both tty and tty->link. The fix
here is to count both tty and tty->link and divide the count by 2 for
user.
And to have ->remove called, let's make tty_driver_remove_tty() global
and call that from pty_unix98_shutdown() (tty_operations->shutdown).
While at it, let's document that when ->shutdown is defined,
tty_shutdown() is not called.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
commit 8c4074cd2254606aeb788d518ccc27c9f97129e1 upstream.
Since commit e0626e38 (spi: prefix modalias with "spi:"),
the spi modalias is prefixed with "spi:".
This patch adds "spi:" prefix and removes "-spi" suffix in the modalias.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
commit dbb3b1ca5609d1f3848cd387d06cc60aaacf7f98 upstream.
This is to fix an issue where output will suddenly become very slow.
The problem occurs on 8250 UARTS with the hardware bug UART_BUG_THRE.
BACKGROUND
For normal UARTs (without UART_BUG_THRE): When the serial core layer
gets new transmit data and the transmitter is idle, it buffers the
data and calls the 8250s' serial8250_start_tx() routine which will
simply enable the TX interrupt in the IER register and return. This
should immediately fire a THRE interrupt and begin transmitting the
data.
For buggy UARTs (with UART_BUG_THRE): merely enabling the TX interrupt
in IER does not necessarily generate a new THRE interrupt.
Therefore, a background timer periodically checks to see if there is
pending data, and starts transmission if that is the case.
The bug happens on SMP systems when the system has nothing to transmit,
the transmit interrupt is disabled and the following sequence occurs:
- CPU0: The background timer routine serial8250_backup_timeout()
starts and saves the state of the interrupt enable register (IER)
and then disables all interrupts in IER. NOTE: The transmit interrupt
(TI) bit is saved as disabled.
- CPU1: The serial core gets data to transmit, grabs the port lock and
calls serial8250_start_tx() which enables the TI in IER.
- CPU0: serial8250_backup_timeout() waits for the port lock.
- CPU1: finishes (with TI enabled) and releases the port lock.
- CPU0: serial8250_backup_timeout() calls the interrupt routine which
will transmit the next fifo's worth of data and then restores the
IER from the previously saved value (TI disabled).
At this point, as long as the serial core has more transmit data
buffered, it will not call serial8250_start_tx() again and the
background timer routine will slowly transmit the data.
The fix is to have serial8250_start_tx() get the port lock before
it saves the IER state and release it after restoring IER. This will
prevent serial8250_start_tx() from running in parallel.
Signed-off-by: Al Cooper <alcooperx@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
commit 44178176ecc55ad370b837dd2c4b4b8bed1e3823 upstream.
This patch adds support for the Rosewill RC-305 four-port PCI serial
card, and probably any other four-port serial cards based on the
Moschip MCS9865 chip, assuming that the EEPROM on the card was
programmed in accordance with Table 6 of the MCS9865 EEPROM
Application Note version 0.3 dated 16-May-2008, available from the
Moschip web site (registration required).
This patch is based on an earlier patch [1] for the SYBA 6x serial
port card by Ira W. Snyder.
[1]: http://www.gossamer-threads.com/lists/linux/kernel/1162435
Signed-off-by: Eric Smith <eric@brouhaha.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
commit b280a97d1caf6fe1d38b51ebb31219391f5ad1a0 upstream.
Fixes logic bug that software flow control cannot be disabled, because
serial_omap_configure_xonxoff() is not called if both IXON and IXOFF bits
are cleared.
Signed-off-by: Nick Pelly <npelly@google.com>
Acked-by: Govindraj.R <govindraj.raja@ti.com>
Tested-by: Govindraj.R <govindraj.raja@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
The execution of Rx enqueue command, Rx flush command and setting of
rx.flush state should happen in atomic way. It happens that start_rx()
and set_termios() might be executing concurrently while doing Bluetooth
ON after some iterations, which is putting ADM into bad state and it
stalls Rx transfer showing as Bus Error.
Disable Rx DM Interface before sending flush command and changing
protocol configuration from set_termios(). This will make sure that even
enqueue/flush is not in synchronization while changing the baud rate OR
moving between different line discipline (not supposed to happen
frequently, but in some case it is seen). There is hardware signals
( uart _dm_rx_dm_req and uart _dm_rx_dm_ack ) between UARTDM core and ADM
which is used to make request and acknowledge the same. Disabling Rx DM
interface causes ADM to terminate the current RX transfer.
CRs-Fixed: 296523
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Currently driver supports max baud rate as 115200 bps.
This change allows to use higher baud rate like 230400 bps
and 460800 bps.
CRs-fixed: 298417
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
This change allows to use debugfs entry called loopback.uart_id to
enable/disable uartdm internal loopback mode.
e.g. for /dev/ttyHSL0 device,
it creates <debugfs_dir>/msm_serial_hsl/loopback.0
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Rxstale interrupt is not working after changing the baud rate once device
is opened. It is required to reset the receiver and transmitter after
modifying the IPR register which is not done in current programming
sequence. This change resets uartdm core i.e. receiver, transmitter, error
state, break condition, CTS and RFR which fixes the issue.
With this change, remove programming sequence used in startup as opening
the device node will always calls set_termios after startup.
CRs-Fixed: 294380
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Enable the bus clock when configuring the GSBI registers
for UART mode in the msm_serial_hs_lite driver.
CRs-Fixed: 292755
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
UART clock rate is set to zero while disabling the uart clock for
subsystem restart feature. It is required to set the uart clock rate
to 7372800 Hz while enabling UART clock. Hence use uart_change_pm in
serial core to call msm_hsl_power api to achieve the same.
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6:
dt: include linux/errno.h in linux/of_address.h
of/address: Add of_find_matching_node_by_address helper
dt: remove extra xsysace platform_driver registration
tty/serial: Add devicetree support for nVidia Tegra serial ports
dt: add empty of_property_read_u32[_array] for non-dt
dt: bindings: move SEC node under new crypto/
dt: add helper function to read u32 arrays
tty/serial: change of_serial to use new of_property_read_u32() api
dt: add 'const' for of_property_read_string parameter **out_string
dt: add helper functions to read u32 and string property values
tty: of_serial: support for 32 bit accesses
dt: document the of_serial bindings
dt/platform: allow device name to be overridden
drivers/amba: create devices from device tree
dt: add of_platform_populate() for creating device from the device tree
dt: Add default match table for bus ids
commit 8c2381af0d3ef62a681dac5a141b6dabb27bf2e1 upstream.
Currently, the hvc_console_print() function drops console output if the
hvc backend's put_chars() returns 0. This patch changes this behavior
to allow a retry through returning -EAGAIN.
This change also affects the hvc_push() function. Both functions are
changed to handle -EAGAIN and to retry the put_chars() operation.
If a hvc backend returns -EAGAIN, the retry handling differs:
- hvc_console_print() spins to write the complete console output.
- hvc_push() behaves the same way as for returning 0.
Now hvc backends can indirectly control the way how console output is
handled through the hvc console layer.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Acked-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
commit f2eb3cdf14457fccb14ae8c4d7d7cee088cd3957 upstream.
Kconfig allows enabling console support for the SC26xx driver even when
it's configured as a module resulting in a:
ERROR: "uart_console_device" [drivers/tty/serial/sc26xx.ko] undefined!
modpost error since the driver was merged in
eea63e0e8a [SC26XX: New serial driver for
SC2681 uarts] in 2.6.25. Fixed by only allowing console support to be
enabled if the driver is builtin.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-serial@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
commit 5568181f188ae9485a0cdbea5ea48f63d186a298 upstream.
Commit 4539c24fe4 "tty/serial: Add
explicit PORT_TEGRA type" introduced separate flags describing the need
for IER bits UUE and RTOIE. Both bits are required for the XSCALE port
type. While that patch updated uart_config[] as required, the auto-probing
code wasn't updated to set the RTOIE flag when an XSCALE port type was
detected. This caused such ports to stop working. This patch rectifies
that.
Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Tested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
commit f086ced17191fa0c5712539d2b680eae3dc972a1 upstream.
FCS could be GSM0_SOF, so will break state machine...
[This byte isn't quoted in any way so a SOF here doesn't imply an error
occurred.]
Signed-off-by: Alek Du <alek.du@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
[Trivial but best backported once its in 3.1rc I think]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* 'at91/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/linux-2.6-arm-soc:
AT91: Change nand buswidth logic to match hardware default configuration
at91: Use "pclk" as con_id on at91cap9 and at91rm9200
at91: fix udc, ehci and mmc clock device name for cap9/9g45/9rl
atmel_serial: fix internal port num
at91: fix at91_set_serial_console: use platform device id
Some platforms e.g. TI Davinci require 32-bit accesses to the UARTs.
The of_serial driver currently registers all UARTs as UPIO_MEM. Add a
new attribute "reg-io-width" to allow the port to be registered with
different IO width requirements.
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>