Commit Graph

242 Commits

Author SHA1 Message Date
Sarangdhar Joshi fd7c7fc302 coresight: add driver support for scatter gather feature
Add driver support to enable scatter-gather feature with TMC configuration.
Scatter gather option for ETR DDR mode supports the use of a table of
locations of 4K blocks of physical memory. Since this memory is not
necessarily contiguous, user can increase the trace buffer size as long as
DDR memory is available.

Default memory option is "contig" for TMC ETR DDR configuration. User can
enable scatter gather feature dynamically.

Change-Id: I74136fb86fe751aa33607d3922dce5d572f0a4a2
Signed-off-by: Sarangdhar Joshi <spjoshi@codeaurora.org>
2014-03-26 18:13:14 -07:00
Sarangdhar Joshi 2365442aa8 coresight: enable scatter gather feature based on dt entry
Based on sg-enable DT entry, enable scatter gather feature
for TMC ETR configuration. Scatter gather feature is not supported
on all targets. sg-enable entry will help to enable this feature
only on those targets which supports this feature.

Change-Id: I66fe50c653ad9646104b9dc0d77a0fa6f82503dd
Signed-off-by: Sarangdhar Joshi <spjoshi@codeaurora.org>
2014-03-24 10:52:01 -07:00
Linux Build Service Account 13807cea1a Merge "coresight: use dev_err_ratelimited for byte counter overflow message" 2014-03-15 10:09:18 -07:00
Linux Build Service Account eaf32dcae4 Merge "coresight: add device attribute for etr ddr mem type" 2014-03-15 10:08:52 -07:00
Linux Build Service Account b8360c9710 Merge "soc: qcom: memory_dump_v2: add client support for memory dump v2" 2014-03-14 07:45:03 -07:00
Linux Build Service Account c27becdfa1 Merge "soc: qcom: memory_dump: cleanup in preparation for memory dump v2" 2014-03-14 07:44:56 -07:00
Linux Build Service Account bd9fa0e149 Merge "coresight: add support for etmv4" 2014-03-13 19:40:27 -07:00
Sarang Joshi 9094a9bf20 coresight: add device attribute for etr ddr mem type
Add device attribute for memory type option with TMC ETR DDR configuration.
This is in preparation for scatter gather feature with TMC ETR
configuration.

Change-Id: If72078f89442e9c58e09392fbced362126dd15e7
Signed-off-by: Sarang Joshi <spjoshi@codeaurora.org>
2014-03-13 17:14:03 -07:00
Pratik Patel 689346a4bf soc: qcom: memory_dump_v2: add client support for memory dump v2
Add client support to register with the memory dump v2 driver to
take advantage of the new enhanced memory dump format.

Change-Id: I8b05d92b3e9f4d1dcaa6dffec8fe05401d72a7ee
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2014-03-13 14:29:05 -07:00
Pratik Patel 1ec292845e soc: qcom: memory_dump: cleanup in preparation for memory dump v2
General cleanup to avoid global name space clashes. This is in
preparation for the memory dump v2 driver.

Change-Id: I884ff3a06c74166dc0cd9004085ab9b43646ef6a
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2014-03-13 14:29:05 -07:00
Linux Build Service Account e7ba90fd33 Merge "USB: usb_bam: Change the bam handle to ulong" 2014-03-12 20:12:41 -07:00
Aparna Das fbc618a08a coresight: add support for etmv4
Add support for Embedded Trace Macrocell v4 trace architecture
which is required for instruction trace on ARMv8 arctitecture.

Change-Id: Iff24690e3161eb12d6f0e09af0c45f9739c7ca66
Signed-off-by: Aparna Das <adas@codeaurora.org>
2014-03-12 18:21:58 -07:00
Sarang Joshi a748e7052d coresight: use dev_err_ratelimited for byte counter overflow message
When byte counter feature is enabled, if the rate at which we receive IRQs
is so high that userspace is unable to read the data fast enough, we
throw byte counter overflow error message. However these messages can cause
log spew resulting in watchdog bark/bite. Limit byte counter overflow
message spew by using rate limited function.

Change-Id: I714323893330368965f70a137aaef7ef7cd4029d
Signed-off-by: Sarang Joshi <spjoshi@codeaurora.org>
2014-03-12 15:27:40 -07:00
Aparna Das cb3d90649a coresight: add pin control support for tpiu driver
Use pin control framework to configure pin resources for
obtaining TPIU trace via mictor instead of GPIO lib
implementations used earlier. Modify the CoreSight TPIU driver
to implement this change.

Change-Id: Ifc565994214ee7c4f7abb97b4222352becfdf2b4
Signed-off-by: Aparna Das <adas@codeaurora.org>
2014-03-10 16:17:22 -07:00
Sujeet Kumar 2d9e27fa48 USB: usb_bam: Change the bam handle to ulong
Change the bam handle data type from u32 to
unsigned long to match sps connect source
and destination.

Change-Id: I55ce477a40e4ab3d1306f8afd1acf491c22874e9
Signed-off-by: Sujeet Kumar <ksujeet@codeaurora.org>
2014-03-08 05:22:15 +05:30
Aparna Das 4facbd0621 coresight: add support for qpdi driver
Add support for CoreSight QPDI driver which provides
controlled access to PMIC Debug Interface.

Change-Id: Ia2e6cc4e276923b55f34046a6a422e7533768e72
Signed-off-by: Aparna Das <adas@codeaurora.org>
2014-03-03 13:31:49 -08:00
Sarang Joshi b155399efd coresight: allocate etr ddr memory dynamically
Dynamically allocate ETR DDR memory so that user can specify
trace buffer size at runtime.

Change-Id: I081b017fa147d7c87789cc504cd9b61b7365c79f
Signed-off-by: Sarang Joshi <spjoshi@codeaurora.org>
2014-02-28 13:09:09 -08:00
Linux Build Service Account 59acb37c59 Merge "coresight: add device attribute for etr ddr mem size" 2014-02-26 21:28:12 -08:00
Linux Build Service Account 78025e56f0 Merge "coresight: add event to abort tracing late on kernel panic" 2014-02-26 10:05:08 -08:00
Sujeet Kumar af110c4d33 USB: mach: Move the mach headers to common location
As part of moving the headers from mach directory
to a common location compilation issues are arising.

Make the changes which are relevant for USB with
its own header files and also dependent header
files.

Change-Id: Ieef7d04ffdfda249f434e0676fec6da8d8b9cf2c
Signed-off-by: Sujeet Kumar <ksujeet@codeaurora.org>
2014-02-25 05:53:32 +05:30
Sarang Joshi fdb945350e coresight: add event to abort tracing late on kernel panic
We call coresight_abort() early in panic pathway to avoid trace buffer
getting cluttered with uninteresting messages; however sometimes it tends
to loose important info such as kernel sending notification to all
peripheral subsystems since it happens after aborting of CoreSight trace.
Add trace event to abort tracing late in kernel panic.
trace_event_kernel_panic and trace_event_kernel_panic_late are mutually
exclusive and can be control using module parameter. With this change user
will be able to choose whether to abort CoreSight trace early or late on
kernel panic.

Change-Id: I84cc299823d929fdf8129c9c728282b32391b7c1
Signed-off-by: Sarang Joshi <spjoshi@codeaurora.org>
2014-02-24 12:31:50 -08:00
Sarang Joshi 87d84607d7 coresight: add event to abort tracing on kernel panic
Add trace event to control aborting CoreSight trace
dynamically based on module parameter. This will help
user to enable/disable coresight_abort on kernel panic.
Also moved CREATE_TRACE_POINTS to panic.c from fault.c
since panic.c is common and shared between 32 and 64
bit platforms.

Change-Id: I51e4049b07adeca571b1a98cd90ff5f307d1d794
Signed-off-by: Sarang Joshi <spjoshi@codeaurora.org>
2014-02-21 16:41:14 -08:00
Sarang Joshi 441ff248c2 coresight: add device attribute for etr ddr mem size
Add device attribute to control ETR DDR memory size dynamically
for TMC configuration. This will help users to specify DDR trace
buffer size at runtime.

Change-Id: Ie1edef7f972435193c96dafb8a94fd6cce97ce6c
Signed-off-by: Sarang Joshi <spjoshi@codeaurora.org>
2014-02-18 23:27:02 -08:00
Linux Build Service Account 0b748d84eb Merge "coresight: configure funnels even if qmi service is not present" 2014-02-08 09:39:13 -08:00
Linux Build Service Account 0791dcb389 Merge "msm: memory_dump: move memory dump driver to drivers/soc/qcom" 2014-02-07 23:19:41 -08:00
Aparna Das 39bf86bbac coresight: configure funnels even if qmi service is not present
Allow configuring CoreSight funnels required for remote processor ETM
tracing even if QMI server is not available to handle QMI client
requests. This allows enabling ETM trace via other alternatives and
use CoreSight drivers to collect trace data.

Change-Id: I43ba5ba5050af23877ddc53694418c35356bae4f
Signed-off-by: Aparna Das <adas@codeaurora.org>
2014-02-06 08:34:47 -08:00
Xiaogang Cui cd76c0793d msm: memory_dump: move memory dump driver to drivers/soc/qcom
Architectural changes in the ARM Linux kernel tree mandate
the eventual removal of the mach-* directories. Move the
memory dump driver to drivers/soc/qcom and the memory dump header
to include/soc/qcom to support that removal.

Change-Id: If04f6a4fcd30c864321ac0ff8c6691fc20707cc1
Signed-off-by: Xiaogang Cui <xiaogang@codeaurora.org>
Signed-off-by: Aparna Das <adas@codeaurora.org>
2014-02-05 18:32:30 -08:00
Dipen Parmar 7f918cb5c7 msm: sps: remove sps header file
Remove the sps header file from older location as sps
driver and clients need to use new header file from
new location include/linux.

Resolve the warnings/errors from client drivers due to
new sps header changes.

Change-Id: I1cdb87756abf3425a9bb5d8bf89cd1aa03a01716
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2014-02-05 15:31:11 -08:00
Xiaogang Cui c4bad5cccc coresight: Fix compile errors for gcc-4.8
Fix compilation errors to support gcc-4.8

There is compilation warnning when use '%d" to print a argument
which type is size_t.

In file included from kernel/include/linux/kernel.h:14:0,
	from kernel/drivers/coresight/coresight-tmc.c:13:
kernel/drivers/coresight/coresight-tmc.c: In function 'tmc_read':
kernel/include/linux/dynamic_debug.h:64:16: warning:
	format '%d' expects argument of type 'int', but argument 5 has type
	'size_t' [-Wformat=] error, forbidden warning: dynamic_debug.h:64

Change format '%d' to '%zu' to fix this compilation error

Change-Id: Ia746033b76df7f06e860031ed8d3e249facbe2b5
Signed-off-by: Xiaogang Cui <xiaogang@codeaurora.org>
2014-02-05 09:33:47 -08:00
Aparna Das 6f78c21df0 coresight: remove request for memory reservation using export_compat
The TMC driver now uses dma_alloc_coherent api to allocate contiguous
memory instead of allocate_contiguous_ebi when configured for ETR. This
eliminates the need for EXPORT_COMPAT support in the TMC driver.

Change-Id: I79550d2ff490c02329e4b860b8aa8816d4890d50
Signed-off-by: Aparna Das <adas@codeaurora.org>
2014-02-03 14:49:04 -08:00
Xiaocheng Li 5f441c883e msm: socinfo: Support multiplatform
Upstream prefers existing drivers be converted to support multiplatform
kernels.  This requires drivers to be located in directories that
contain generic functionality instead of specific mach directories.
Move the socinfo driver into drivers/soc/qcom and update the initcall
levels to satisfy dependencies.

Change-Id: If195cd793d84867d371f25136a88f2a7ce239500
Signed-off-by: Xiaocheng Li <lix@codeaurora.org>
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
2014-01-30 19:08:34 -08:00
Aparna Das 2f2b31e76d coresight: add qmi message support for remote processor etm tracing
Add QMI messaging support to communicate with remote processors to
enable or disable ETM on remote processors.

Change-Id: I7018492284f1e5816302189f8c4f918b3ab79a64
Signed-off-by: Aparna Das <adas@codeaurora.org>
2014-01-24 06:40:58 -08:00
Sarang Joshi 2d5f553dc4 coresight: take lock before modifying byte cntr value
Byte counter overflow is computed based on byte counter value during
byte counter start routine. Two different threads running in parallel
can cause synchronization issue where one thread modifies overflow
based on byte counter value and other thread modifies byte counter
value at the same time. Take respective lock before setting byte
counter value.

Change-Id: I923a34bf918abe4d5e3b0d30ed4887a38db6f427
Signed-off-by: Sarang Joshi <spjoshi@codeaurora.org>
2013-12-17 15:08:49 -08:00
Pratik Patel 2d85f9a856 coresight: initialize waitqueue before devm_request_irq
Initialize waitqueue before devm_request_irq to make static
analysis tools happy.

Change-Id: Iec85520453a4191a6e2e2abb0d4db8dc27b11533
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-12-02 15:18:46 -08:00
Ian Maund f06163e6d0 msm: reap unused kernel files
This change removes source files from the kernel tree that
were not being used during make. The list of used files
was generated using an annotated make log and was then
compared with new files added since the public release of
kernel version 3.10.00. New files which were added but
not used have been removed from the tree.

A diff was also run to determine the list of files that had
been modified since the release of kernel version 3.10.00.
These files were then scrubbed based on the current kernel
configuration, removing invalid and unused conditionals.

Some files which support planned functionality or are
useful in debugging have been excluded from this reap.

Change-Id: Ia44a224d3cea7bc78dd45e8a8279860d35d4b008
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2013-11-21 17:45:28 -08:00
Pratik Patel 5597394769 coresight: rearrange trigin and trigout show function locations
Rearrange show_trigin and show_trigout function locations to be
consistent with other CoreSight drivers.

Change-Id: Ic877155e49aa9379ba98e8473812b7f0359e8024
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-11-19 10:04:06 -08:00
Pratik Patel e8b35518bc coresight: add cti enable and disable gate functions
Add support for cti enable and disable functions to allow use
cases that require the ability to control the trigger outputs
independent of the trigger mapping and generation configuration.

Change-Id: Id94809be629bb3939a67e8f6711733810aeb1f37
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-11-19 10:04:06 -08:00
Pratik Patel d388cce171 coresight: add cti set and clear trigger functions
Add support for setting and clearing triggers to allow use cases
that require software based trigger setting and clearing
functionality.

Change-Id: I826b238f2cb1050394134030bd0810bbcdeb2662
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-11-19 10:04:05 -08:00
Pratik Patel 38a40145db coresight: add cti pulse trigger function
Add support for pulse triggering to allow uses cases that require
software based pulse trigger generation.

Change-Id: I1ce8fd40cfd0622364c101f9d9bc8aa4540b0344
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-11-19 10:04:05 -08:00
Pratik Patel 1fe2a79766 coresight: split cti verify bounds function
Split cti_verify_bounds into cti_verify_trigger_bound and
cti_verify_channel_bound so that they can be used individually
when required.

Change-Id: Ic1cd6802b0f5f0e7d9d31da73b0817d8f1909c3d
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-11-19 10:04:05 -08:00
Linux Build Service Account 428cfe3dbd Merge "coresight: abort tracing for unhandled aborts" 2013-11-11 22:15:51 -08:00
Linux Build Service Account 57c7765847 Merge "coresight: make coresight event module configurable" 2013-11-05 19:11:39 -08:00
Sarang Joshi 23925d1ee1 coresight: abort tracing for unhandled aborts
Add trace event to abort tracing for unhandled aborts such as
data abort and prefetch abort. A common event 'trace_unhandled_abort'
is shared for all unhandled aborts.

Change-Id: I6da9b30c74be48252402188a6f9a7703d21d6276
Signed-off-by: Sarang Joshi <spjoshi@codeaurora.org>
2013-11-05 15:05:05 -08:00
Sarang Joshi 2019121d55 coresight: make coresight event module configurable
The coresight event module helps abort tracing on user fault
and undefined instruction exceptions. Add module parameter to
control it dynamically.

Change-Id: Iecaa144b99e3786c8c8f570f989f747be12c4fdc
Signed-off-by: Sarang Joshi <spjoshi@codeaurora.org>
2013-11-04 19:28:50 -08:00
Linux Build Service Account 8cf6ee43b3 Merge "coresight: modify function names and messages" 2013-11-01 20:48:24 -07:00
Sarang Joshi 00d8d627f5 coresight: check if gpio count is positive before using
If gpio entries are not present in dt file, the resource query
function returns negative value for gpio count. Currently data
type for gpio count is unsigned int which wraps around and gives
positive result for negative value that causes failure while
probing the driver. Modify gpio count data type to integer and
check if it is positive before using it.

Change-Id: I1596f3d1090f5caa70735c66e10f82914ac7ab26
Signed-off-by: Sarang Joshi <spjoshi@codeaurora.org>
2013-10-31 10:03:35 -07:00
Sarang Joshi 177fb74435 coresight: modify function names and messages
Modify function names and messages to be consistent with other
modules. Modify function names starting with control_* to
event_*, abort_control_tracing to event_trace_user_fault and
abort_tracing_undef_instr to event_trace_undef_instr.

Change-Id: Ic6101dc8024b8d10713c162ea93e268ba59eaf8a
Signed-off-by: Sarang Joshi <spjoshi@codeaurora.org>
2013-10-28 20:56:21 -07:00
Linux Build Service Account efe83c7f77 Merge "coresight: fix error checks for byte counter init code" 2013-10-25 08:19:00 -07:00
Pratik Patel 12f1c666d5 coresight: fix error checks for byte counter init code
Fix error checks for byte counter initialization functions that
are called during probe to avoid null pointer accesses.

CRs-Fixed: 562303
Change-Id: I8f7de6fc4b0658cf649e472d12a00ea5733a8b0a
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-10-23 17:34:51 -07:00
Aparna Das 9f167a15ac coresight: add support for NIDnT modes
Add support to switch between various Narrow Interface for Debug and
Trace (NIDnT) modes namely Serial Wire Debug, UART and Trace modes
through SD card interface.

Change-Id: I3d263fe7ec623b0d9c81021d79a69ba5b54ad7e0
Signed-off-by: Aparna Das <adas@codeaurora.org>
2013-10-23 17:13:12 -07:00
Aparna Das 0f610611d1 coresight: support etm tracing on remote processors
Currently the remote processors do not have access to CoreSight debug
and trace framework. Add support for configuring the required CoreSight
components to enable ETM tracing on these processors.

Change-Id: I1a2aa6567f26124124cf1c570575836e62519052
Signed-off-by: Aparna Das <adas@codeaurora.org>
2013-10-04 14:53:17 -07:00
Aparna Das 74b9664470 coresight: query cti mappings only when cti is enabled
Read cti mappings only when cti is enabled to ensure required cti clock
is enabled.

Change-Id: I7500b44a44c058f37497c2226b8e1b097e734b87
Signed-off-by: Aparna Das <adas@codeaurora.org>
2013-09-05 14:53:04 -07:00
Pratik Patel 38227b0337 coresight: use fixed clock rate for tpiu sdc use case
Vote for a fixed clock frequency for TPIU output to SD to
workaround trace data corruption issues across XO shutdown.

Change-Id: Iaa7e822899685c3b5d0cc01dea1090e817e9b129
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 17:28:38 -07:00
Aparna Das d0489e342b coresight: disable sdc io regulator when disabling tpiu
The sdc io regulator is configured and enabled when TPIU trace via sdc
is enabled. Disable this regulator when TPIU trace is disabled.

Change-Id: Ib1dfacb1c4977c74b1796f17f763f8abea583171
Signed-off-by: Aparna Das <adas@codeaurora.org>
2013-09-04 17:28:14 -07:00
Pratik Patel 234885a545 coresight: use no log version of readl while dumping etf
During kernel panic, coresight_abort is first called to stop
tracing to the default ETF (circular buffer mode) sink. This is
followed by stopping RTB as part of the panic handler.

Use no log version of readl while dumping ETF in circular buffer
mode to avoid polluting RTB logs with readls responsible for
dumping ETF during kernel panic.

Change-Id: I282516be458c8b38af20cb372803cdff9eb9e8f0
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 17:23:11 -07:00
Aparna Das 878e4c2b2b coresight: use dma_alloc_coherent for allocating tmc-etr memory
The CoreSight TMC driver when configured for ETR requires uncached
memory in RAM to which it routes trace data. In order to allocate
this memory replace existing allocate_contiguous_ebi api with
dma_alloc_coherent api which is the linux standard of allocating
memory.

Change-Id: I59f88009f2abed95fd9b81ea92a7d484b9d6b833
Signed-off-by: Aparna Das <adas@codeaurora.org>
2013-09-04 17:21:50 -07:00
Pratik Patel 126b76f777 coresight: enable flush-on-flushin for periodic flush to usb
Periodic flushing for ETR to USB uses ETR flush-on-FLUSHIN
external input. Hence, enable flush-on-FLUSHIN by default when
enabling ETR to USB transfers and work around the manual flush
failure by skipping it during ETR to USB disable. Adjust the
periodic flush threshold to the maximum value in order to
reduce the overhead when there is no data to be transferred.

CRs-Fixed: 461885
Change-Id: Ie3a1bbc80e017f187af56fcfdfb52297ba9aa72d
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 17:21:38 -07:00
Pushkar Joshi 0d311f9f8d coresight: add lpae support for coresight tmc driver
Modify the CoreSight TMC driver for LPAE so that it can support
ETR physical addresses greater than 32 bits when LPAE is enabled.

Change-Id: I6db2c98c4db70262ab45f7ff11fe2a6846259f8a
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
2013-09-04 17:21:05 -07:00
Aparna Das 862a5d2926 coresight: add support to reset cti block
Add support to reset each CoreSight cti device through sysfs. This
disables all cross triggering functionality on cti device by
unmapping all mapped cti trigins and cti trigouts and disabling the
cti device.

Change-Id: I4d1f48ad63e1317c893471e1818cd529dd2b002b
Signed-off-by: Aparna Das <adas@codeaurora.org>
2013-09-04 17:19:22 -07:00
Pushkar Joshi 652e5255d4 coresight: disable byte counter if byte counter initialization fails
The byte counter feature is enabled only if all the components it relies
on can be succesfully enabled.

Change-Id: I09e9b78c21af66d8cfc7c94d286f5b61adb7f7d6
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
2013-09-04 17:19:11 -07:00
Aparna Das e0abee5ff2 coresight: configure sdc io regulator for tpiu trace via sdc
For trace via sdc the sdc io regulator needs to be configured and enabled.
Add support for this in CoreSight driver instead of depending upon the
configured values of sdc io regulator on bootup.

Change-Id: I65f341c1dde58ee5e66372bcfb11393fc33bef54
Signed-off-by: Aparna Das <adas@codeaurora.org>
2013-09-04 17:18:50 -07:00
Pushkar Joshi 73389e5ed3 coresight: perform byte counter value check only for non-zero values
A check for the byte counter interrupt value being such that it
divides the memory reserved into equal size blocks is necessary
only when a non-zero value is specified.

Change-Id: I424c09322f2ee82917359d871f0916b3fb50b0be
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
2013-09-04 17:17:25 -07:00
Pushkar Joshi 5913467ded coresight: appropriately handle hardware event mux control registers
Modify the hardware events driver so that it can handle the hardware event
mux control register addresses being greater than 32 bits.

Change-Id: Id41ce183fa946b14590947f21fbcea361393543f
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
2013-09-04 17:16:04 -07:00
Aparna Das 5c55e11a3d coresight: add support to query current cti mappings
Add support to show the CTI channels mapped onto CTI trigger inputs
and CTI trigger outputs via sysfs for each CTI block.

Change-Id: Ib105651f621516dc2055e72c371780cb4497e43a
Signed-off-by: Aparna Das <adas@codeaurora.org>
2013-09-04 17:15:30 -07:00
Aparna Das 49379869df coresight: prevent multiple map or unmap of same cti trigger channel pair
Do not allow mapping or unmapping the same cti trigin or cti trigout
multiple times onto the same ctm channel. Also prevent reference count
increment or decrement in this case which prevents incorrect enabling
or disabling of cti block.

Change-Id: Iebf7e2799e523f803f4509f5ab75fb238c7097ed
Signed-off-by: Aparna Das <adas@codeaurora.org>
2013-09-04 17:13:22 -07:00
Pushkar Joshi 0c95f352e5 coresight: Add support for byte counter interrupt feature
The CoreSight block can produce an interrupt on transfer of
programmed number of bytes to ETR-memory. Use this feature
to provide an interface to manage the byte counter value and
to collect a continuous data stream from userspace.

Change-Id: Ic00c9b19483be566d0f05005936b4a6ff7ab52f1
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
2013-09-04 17:12:34 -07:00
Pratik Patel 7581e40ed7 coresight: return correct size for stm_send
Ensure correct value for number of bytes sent is returned by
stm_send function.

Change-Id: I866e9c1c95ab645ad54c5c4eb84a433421380cf5
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 17:07:32 -07:00
Pratik Patel 108dc514ac coresight: add coresight fuse state query
Add support to query CoreSight fuse state and fail the probe
if any of the required fuse(s) are disabled. This enables
a single image with CoreSight drivers compiled in to be run on
both Hardware that has CoreSight functionality disabled via fuse
or left enabled for use.

Change-Id: Ib770cc7f76e2b0644bda9600c92fc3a26823452d
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 17:06:21 -07:00
Pratik Patel 6983a1010a coresight: add coresight fuse driver
Add support for CoreSight Fuse driver which can be used by other
CoreSight drivers to query the state of the CoreSight fuses to
determine if the Hardware they manage is functionally disabled or
not.

Drivers can then take necessary actions like failing the probe if
the Hardware they manage is functionally disabled.

Change-Id: I2c2a2af064db750539b0ffa33870ddb7a2832e68
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 17:06:17 -07:00
Pratik Patel 0468252ee6 coresight: remove hotplug locking from etm probe
Calling register_hotcpu_notifier inside of get/put_online_cpus
i.e. after taking the cpu_hotplug lock results in a deadlock
since register_hotcpu_notifier takes the cpu_add_remove_lock
which has already been acquired by the hotplug code before
requesting the cpu_hotplug lock.

Remove the get/put_online_cpus calls since they are not required.

CRs-Fixed: 501374
Change-Id: I3fb58265f6fedeb696d035d281af0d7904e28b79
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 17:02:44 -07:00
Pratik Patel 51d355115b coresight: use trigin 2 for cti reset trigger for tmc-etr
Flush ETR is mapped to TRIGIN[2] and so switch to using it in
order to cause a CTI trigger for TMC-ETR flush during wdog reset.

This avoids any race between TMC-ETR flush to memory and DDR
being put into self-refresh.

CRs-Fixed: 491986
Change-Id: Ia5e643121e040bd9c57c89a4b762b794bc8ddf62
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 16:54:28 -07:00
Pratik Patel d46f2afa4d coresight: move of_coresight.c to drivers/of
Move of_coresight.c from drivers/coresight to drivers/of where
all the of drivers files belong. of_coresight.c compilation will
now depend on CONFIG_CORESIGHT. Also make other appropriate
changes to Kconfig and Makefiles to support this.

This will allow other drivers using of_coresight.c apis to
compile and link successfully even when CONFIG_CORESIGHT is
disabled.

Change-Id: I05a32cb3f15767adf10de0a6b4b133e85a70e710
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 16:36:24 -07:00
Pratik Patel a70f107d4b coresight: free temporarily allocated memory when done using it
Free temporarily allocated memory pointed to by seta_cfgs and
setb_cfgs when we are done using it.

Change-Id: Id3b27277fe1ed1897acb49ac8593d295108f0472
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 16:35:04 -07:00
Pratik Patel 2d1c389ede coresight: release tpiu regulator of node only when done using it
Currently TPIU regualtor DT of node gets released on encountering
errors while reading voltage or current levels which can cause
use after free issues. Ensure the regulator of node gets released
only when we are completely done using it.

Change-Id: Ifaf8469aedb77e7d9fc6f71dab99417414f4e88d
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 16:35:03 -07:00
Pratik Patel 57fe30be0b coresight: support sdc regulators without voltage/current levels
Add support for sdc regulators that don't have voltage or current
levels. This will allow tpiu output via sdc connector on chips
that power sdc connector with regulators without voltage and
current level support.

Change-Id: I03e9e94aebef3fc54a59922c50743ea8624bfdcf
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 16:33:11 -07:00
Aparna Das 9cd9ea86e1 coresight: add support for coresight hardware event driver
The STM hardware event interface allows monitoring and tracing
of up to 32 hardware events. The CoreSight Hardware Event driver
programs various hardware event mux control registers to configure
these hardware events based on user selection. Currently APSS
controlled hardware event configurations are supported.

Change-Id: Ic2749ae1a8d405159cc7e8210dfc1d8864f96df9
Signed-off-by: Aparna Das <adas@codeaurora.org>
2013-09-04 16:31:23 -07:00
Pratik Patel 7f9855900b coresight: use export_symbol api consistently
Switch to using EXPORT_SYMBOL from EXPORT_SYMBOL_GPL where
applicable to make export symbol api usage consistent for all
coresight drivers.

Change-Id: Iad00b6a55a23a9ae87a5534d523e4e1eb1c56395
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 16:24:57 -07:00
Pratik Patel 5a8aaca28d coresight: enable clocks during hotplug when required
Vote for enabling clocks during hotplug ON in CPU_UP_PREPARE and
correspondingly vote to disable clocks in CPU_ONLINE or
CPU_UP_CANCELED callbacks until OS lock is unlocked. This is
required since memory mapped accesses to unlock the OS lock as
part of CPU_STARTING callback for some ARM based cpus need the
appropriate clocks to be on.

Change-Id: Ia9709692beb02654c225a0771c1eea556d581372
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 16:23:25 -07:00
Aparna Das 23a951523e coresight: modify coresight drivers to use reg-names property
Modify coresight drivers to perform resource lookup by name. The
coresight drivers now use the reg-names property specified in dt
nodes to lookup for resources.

Change-Id: I986f9687be81706d2424e288b9875c3a93e12d11
Signed-off-by: Aparna Das <adas@codeaurora.org>
2013-09-04 16:13:53 -07:00
Pratik Patel 7d7b96f4ba coresight: support for tpiu output to mictor and sdc connectors
Add support to allow tpiu to output trace data to the mictor or
sdc connectors depending upon user configuration via sysfs nodes.
This will allow tpiu trace usage without JTag hence improving the
usability.

Change-Id: I905f1ae844eb46faa9d0fceb47cd89c425110305
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 16:12:54 -07:00
Shimrit Malichi 78ea2d8b19 usb: usb_bam: Add support for multi USB BAMs
This change add the support for activating more than
one usb core in the system in bam to bam mode.
Potentially, we can have up to three usb cores in
the system: HSUSB, HSIC and DWC3.
This change simplify the USB BAM driver design, such that
we can easily define bam to bam paths for more than one usb
core concurrently with flexible peer BAMs configuration.

Change-Id: Ie5acb68f29e30cb6c14d2afd957ac8e21cc7beba
Signed-off-by: Shimrit Malichi <smalichi@codeaurora.org>
2013-09-04 16:09:29 -07:00
Pushkar Joshi ceb6ad0d5c coresight: OS unlock for non-krait CPUs using memory mapped access
On CPUs which implement OS lock mechanism, the ETM driver needs to unlock
the OS lock in order to configure ETM registers. Implement OS unlock on
CPUs using a memory mapped access instead of cp14. This is necessary on
CPUs which implement OS lock mechanism and provide only memory mapped
accesss to ETM registers.

Change-Id: I1559cc32e77a5d3cd42badf4f81ca253cd316f5d
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
2013-09-04 16:09:13 -07:00
Pratik Patel ab2ff8dba2 coresight: add support for ost mipi 1.0 protocol
Add support for OST MIPI 1.0 protocol while using the simple
start token value of 0x10 for better performance since it avoids
sending the lenght field.

Use this standard OST MIPI 1.0 protocol except when only 64bit
writes are supported by STM in which case fallback to the
proprietary OST protocol.

CRs-Fixed: 433920
Change-Id: I73bcc44928a8807817b32636ca25b0aa82c7e4a9
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 16:03:44 -07:00
Pratik Patel 387746291f coresight: use cp15 cpmr_etmclken instead of etmpdcr for krait
Krait v4 only supports cp15 CPMR_ETMCLKEN for turning on ETM
power/clock for subsequent cp14 accesses so use it instead of
ETMPDCR. Other Kraits also support cp15 CPMR_ETMCLKEN for turning
on ETM power/clock so it can be safely used for all Kraits.

Change-Id: I404b96d84a3c9329bf9a571db7ce57b91d9dc76c
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 16:03:43 -07:00
Pratik Patel 06d43e8c44 coresight: disable tmc-etr to bam traffic during coresight abort
Add support for disabling TMC-ETR to USB BAM traffic (which can be
safely done in atomic context) as part of coresight_abort when
TMC-ETR-usb is the current sink.

Change-Id: I13f8989b3807cda89f81144a38be429ddaeb3d76
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 16:03:42 -07:00
Pratik Patel 3dec2bd30c coresight: enable & disable flush on wdog reset using cti for tmc-etr
Program TMC-ETR to stop on flush by default and dynamically
enable flush on watchdog reset using CTI when TMC-ETR-mem is
enabled and disable flush on watchdog reset when TMC-ETR-mem is
disabled.

This will help flush out pending data when a crash causes a
watchdog reset ensuring that most recent data gets captured in
the TMC-ETR-mem.

The need to dynamically enable and disable flush on watchdog
reset based on current sink state arises from ARM recommendation
to have CTI flush enabled only for one sink at a time.

CRs-Fixed: 455170
Change-Id: If780fe4709098b74860d4b32ab2d151e861cf10d
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 16:03:41 -07:00
Pratik Patel 714032754c coresight: enable & disable flush on wdog reset using cti for tmc-etf
Program TMC-ETF to stop on flush by default and dynamically
enable flush on watchdog reset using CTI when TMC-ETF (in circular
buffer mode) is enabled and disable flush on watchdog reset when
TMC-ETF (in circular buffer mode) is disabled.

This will help flush out pending data when a crash causes a
watchdog reset ensuring that most recent data gets captured in
the TMC-ETF.

The need to dynamically enable and disable flush on watchdog
reset based on current sink state arises from ARM recommendation
to have CTI flush enabled only for one sink at a time.

Change-Id: Ib1a57122802e335da776c008da20da68e8527b00
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 16:03:09 -07:00
Pratik Patel 881142c4a2 coresight: add coresight cti driver
Add support for CoreSight Cross Trigger Interface driver which
can be used to setup various cross-triggers available between
hardware blocks. This driver provides both an in kernel api as
well as a sysfs based user interface.

Change-Id: Idf445e6d1a3b082e0101b9b38926584527f1630f
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 16:03:03 -07:00
Pratik Patel fbb9ee10e2 coresight: rename control_trace.c to coresight-event.c
Rename control_trace.c to coresight-event.c to better align the
naming with the rest of coresight driver names.

Change-Id: I132a5df009339a041b21a4ef0cdd22d3c883d32e
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:56:51 -07:00
Pratik Patel 415d8d3770 coresight: split qdss config to more granular coresight configs
Change CONFIG_MSM_QDSS to granular CORESIGHT configs covering
various CoreSight drivers. This better represents the CoreSight
device topology and allows more flexibility in choosing the
drivers required for a particular platform or chip.

Change-Id: I5ae44442c24c88673f2045ad24dc89e4d86d23cb
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:56:50 -07:00
Pratik Patel bba3669d95 coresight: use core_initcall for coresight core layer code
Move to using core_initcall instead of subsys_initcall for the
coresight core layer code so that drivers (eg. bus driver) that
probe early on can use the core layer coresight_register api in
their probe functions.

Change-Id: I8e7f208e177513d4da73d0931a4fa0767841b8cf
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:56:07 -07:00
Pratik Patel 588f27aa4f coresight: improve error handling for exported coresight apis
Enhance error handling to provide graceful behavior in the case
of incorrect topology representation by the user. This
specifically improves the behavior when some of the required
device DT nodes are missed or required driver(s) are not
compiled.

Change-Id: I1bb72732a6f2d230775d8ce1ffec574adc3890d0
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:55:08 -07:00
Pratik Patel 49c4e95b90 coresight: implement new tmc etr to usb flush procedure
Recommended ETR to usb flush procedure changed. This implements
the new recommended procedure.

CRs-Fixed: 443106
Change-Id: I18a6d457686905cbee75ce081ee4c6b4f6fdc62c
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:55:07 -07:00
Pratik Patel cb0777c35b coresight: reset bam before making etr to usb connection
Since USB recently started resetting USB BAM before calling the
cable connect callback, it is recommended that QDSS BAM is reset
before TMC ETR to USB connection is made in the TMC driver.

Change-Id: I37639b9ada69c9d5077812463c05ce5e6176a181
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:55:07 -07:00
Pratik Patel c21f8418fc coresight: turn on etm during first cpu hotplug if enabled in boot
When ETM is enabled via kernel command line or config item but we
boot with maxcpus parameter value of less than number of present
cpus, cpus that are not included as part of maxcpus don't
get ETM enabled during kernel init since those cpus would not be
online.

This change ensures that for such cpus, first hotplug after the
respective cpu's ETM probe is done, enables ETM if it is enabled
via kernel command line or config item but hasn't already been
enabled.

Change-Id: Ie3613819896e781732b80d6be20f930b474418e8
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:51:59 -07:00
Pratik Patel 4056d4a6b6 coresight: hotplug enable/disable etm only for round robin access
Enable and disable ETM during hotplug operations only if ETM is
allowed round-robin access by the funnel when all the ETMs share
the same funnel priority.

For 8960, 8064, etc it is observed that sometimes a core's ETM is
starved by other core ETMs constantly producing data. This works
around an issue seen where setting the prog bit of a core's ETMCR
(i.e. ETMCR[10]) doesn't result in that core's ETMSR[1] getting
set thereby triggering the "timeout while setting prog bit"
warning. Subsequently performaing a manual ETB flush as part of
disabling ETB to retrieve the collected trace data also fails.

Change-Id: I6dd37979058644495d945e80e6a2de4696fc5a20
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:51:58 -07:00
Pratik Patel 6316b7fd79 coresight: remove cpu hotplug locking for smp_calls
smp_calls are cpu hotplug safe and so cpu hotplug locking isn't
required to safeguard them. Remove get_online_cpus() and
put_online_cpus() cpu hotplug locking calls that are currently
safeguarding smp_calls against cpu hoplugging.

Change-Id: I527403f4ffe088f3ee65b0b0899b398e1449ab48
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:51:41 -07:00
Pratik Patel 492f814272 coresight: read block size for tmc-etr to usb transfers from DT
Reading block size to use for tmc-etr to usb transfers from DT
allows the flexibility to configure a different block size per
target.

Change-Id: I5b52db194ebb6fab7d3a02e8fb031bd9936fddd8
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:51:07 -07:00
Pratik Patel 0f30883c19 coresight: return error if null or error is passed to coresight_register
Fail coresight_register if invalid (error or null) argument is
passed to avoid crashes.

Change-Id: I6c39ba2b81333f24480fdf5b348934651e095be5
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:49:50 -07:00
Pratik Patel bb323e8283 coresight: read tmc-etr reservation size from DT node
Remove using hardcoded value for the TMC ETR allocation size in
the TMC driver and instead get the size from the DT node. This
will ensure only one location (DT) controls the size of the
allocation.

Change-Id: I642d149e124c98470821ac4a37627747aecd2af7
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:49:49 -07:00
Pratik Patel 7d09c49037 coresight: support dumping tmc-etf and tmc-etr on kernel panic
Dump TMC ETF and TMC ETR registers on abort to allow post crash
parsing. Also ensure magic value is written for TMC ETF buffer
dump.

Change-Id: I8f21c456bcc79ed3e2831bd6bd1e6a6dbfdb93d0
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:48:58 -07:00
Pushkar Joshi 2d1340e0d0 coresight: 9625: Modify ETM driver to support ETMv3.5
MSM9625 implements ETM based on ETM version 3.5.
As such the 9625 ETM registers need some additonal configuration
for ETM to be functional. They also have some extra registers which
need to be configured properly while some registers currently being
configured by the driver are absent on 9625. Additonally, the ETMv3.5
can be configured to support data tracing, support for which is
not present in the existing ETM driver.

Change-Id: Ic3e61d0d1abf371653a398a28111b308747a7b6f
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
2013-09-04 15:47:58 -07:00
Pratik Patel dcf9ae9cf5 coresight: turn on pcsave during first hotplug if enabled in boot
When PC save is enabled via kernel command line or config item
but we boot with maxcpus parameter value of less than number of
present cpus, cpus that are not included as part of maxcpus don't
get PC save feature enabled during kernel init since those cpus
would not be online.

This change ensures that for such cpus, first hotplug after the
respective cpu's ETM probe is done, enables PC save feature if
the feature is enabled via kernel command line or config item but
hasn't already been enabled.

Change-Id: I9cae33654539ed72885fdf11cd603c7c776512c1
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:38:00 -07:00
Pratik Patel 98837ba674 coresight: clear pwrup just after clearing pwrdwn
Having both both ETMPDCR[3] set and ETMCR[0] cleared causes
pre-mature resumes from suspend power collapse. For now, clear
pwrup (ETMPDCR[3]) right after clearing pwrdwn (ETMCR[0]) to
avoid pre-mature resume from suspend power collapse.

Change-Id: I4b951ecc672d42aa9ea1feb7a5f999d24698405e
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:34:07 -07:00
Pratik Patel c3200e9b43 coresight: keep drvdata->size as the actual buffer size
Consistent with the what is done for TMC ETR, keep the
drvdata->size as representing the size of the actual buffer for
TMC ETF as well since size is used while dumping the buffer.

Change-Id: I2b5355a822898804add81c92bdd2992343195f2c
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:33:16 -07:00
Pratik Patel 853eb07ab2 coresight: attempt to send data over STM only if size is non-zero
Send data over STM only if the data length specified is non-zero.
This will avoid potential issues while avoiding sending empty
packets.

Change-Id: I1792d4b342bdb8cae2c0a8edc2d2584b42c72f6f
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:33:15 -07:00
Pratik Patel b2be7dd9fa coresight: add STM support for explicit userspace entity ids
Add support to transport data sent using userspace library over
STM. Data stream will contain the entity id, protocol id and
options.

Change-Id: I5bd1810338fd13373bbad7de559765002c43c500
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:33:15 -07:00
Pratik Patel 8aa16cf22e coresight: graceful etm enable/disable for offline cores
Fail ETM enable if the core is offline so that it is obvious to
the user that the operation failed. ETM disable cannot fail so
disable ETM during hotplugg off if it is user enabled and
re-enable ETM during hotplugg on if it is user enabled.

Change-Id: I24120582ff6d3c5f3598baff962dc2ef910c3a1e
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:33:10 -07:00
Pratik Patel 3a56e4de3c coresight: change ETM locking scheme from mutex to spinlock
Switch to using spinlocks instead of mutexes to make apis
callable from atomic context.

Change-Id: I6c249b66c7f9db3d6028f1ab92bacfbcf43b150e
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:33:01 -07:00
Pratik Patel cb6bdcbc8d coresight: graceful pcsave enable/disable for offline cores
Fail pcsave enable/disable if the core is offline so that it is
obvious to the user that the operation failed.

Change-Id: I2bd88636e1982a7de6b14f8b742d1f9bc7d23406
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:33:01 -07:00
Pratik Patel 383b9bcc8a coresight: resolve pcsave and etm tracing concurreny issue
Always clear ETMCR[pwrdwn] while enabling trace. This is used as
a logic enable and is a pre-requisite while enabling trace. So
switch to an implementation that does this and removes the save
and restore for pwrdwn and pwrup.

Change-Id: I8a14efe8fd76368ed1e177a701013a504aa1876f
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:32:56 -07:00
Pratik Patel 0f594df7e0 coresight: use 2K block size transfers for output via usb
For better throughput and to avoid limitations, use 2K block size
tranfers when outputting data over usb using ETR. Moreover, USB 3.0
currently only supports 2K block size for the descriptors.

Change-Id: Idc68c4d503e3ccca7715d3cbec21daedfbc2df6f
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:32:23 -07:00
Pratik Patel 0f41a57a3b coresight: implement runtime pc save control
Add runtime control for enabling/disabling program counter save feature.
Enabling program counter save feature will enable pc to be saved on
reset but implies ETM being left powered on. So we provide user runtime
control to enable the feature when debugging or disable it while taking
power measurements.

Change-Id: Ib007da851ee7f3b0fac195da62aac7def68cc67a
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:23:03 -07:00
Pratik Patel 406b39b019 coresight: explicitly control ETMCR & preserve prog & power down bits
Explicitly clear and set ETMCR power down bit as part of the ETM
register programming sequence since if this bit is set, writes to
some registers and fields might be ignored.

Moreover, ETMCR prog and power down bits are not directly modifiable
via the sysfs based MODE selction code. Instead they can implicitly get
modified by other code. So always preserve their values while
enabling ETM trace since the ctrl is a shadow of ETMCR bits that
are only modifiable via the sysfs based MODE selection code.

Change-Id: I842a42acdafb112759a1787ec6fc41140812020d
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:22:59 -07:00
Pratik Patel d4d59cd90d coresight: initialize buf during tmc etr probe
Initialize buf for TMC ETR to the virtual address of the allocated
buffer memory. This will ensure a read on TMC ETR device node when ETF
is the current sink doesn't fail.

Change-Id: Id23dd9502ec728567c5b137354ca2d734f9309dc
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:22:58 -07:00
Pratik Patel 0f04d6d0ea coresight: ignore multiple calls to coresight_abort
coresight_abort allows for abruptly stopping the current sink from
accepting new data hence avoiding polluting trace with information
after the point of interest.

Depending upon the call site, coresight_abort could end up getting
called more than once. This change will help with ignoring
subsequent calls to coresight_abort so that abort callback is
called just once. This is in line with treating abort as a one time
abrupt stop.

Change-Id: I634001e832ee7fa1b23f67698bd2d5dd12f8d65d
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:22:57 -07:00
Pratik Patel 41e8cc8c9d coresight: cp14 support for etm driver for krait v3
Use cp14 accesses to ETM registers for Krait v3 to avoid
limitations with memory mapped accesses.

Change-Id: Ia956eb0f5b45c748ffb5dd13dd14dc9595b9c68a
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:21:49 -07:00
Pratik Patel f8410974a3 coresight: use ETMPDCR instead of ETMCR for ETM power/clock control
Use ETMPDCR instead of ETMCR for ETM power/clock enable/disable. ETMPDCR
doesn't have corresponding cp14 access and hence will help with subsequent
multicore ETM support changes for 8974. ETMPDCR is available for PFTv1.1
and ETMv3.5 compliant ETM implementations.

Change-Id: I4b190b963cda29b406971cf075db36213b140495
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:21:24 -07:00
Pushkar Joshi 0794ed8130 coresight: A DLKM to abort trace on userspace abort
A DLKM to abort tracing on an user space data, prefetch or
undefined instruction abort.

Change-Id: Iaba14628601ea6d3649e05423f8570131eea39f7
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
2013-09-04 15:20:27 -07:00
Pratik Patel 98185a7a34 coresight: simplify etm_init_arch_data
Move etm_arch_supported out of etm_init_arch_data to simplify the
init flow.

Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
Change-Id: I8a95f59e35e74c5af8c447abdc9f0dcd1682bce1
2013-09-04 15:19:06 -07:00
Pratik Patel 77ad30345c coresight: implement crash dumping support
Add support to allow debug image to be able to dump ETF content
and ETM, TMC regsiters in case of apps proc bite or system hang
causing secure watchdog reset.

This will enable host parsing scripts to extract ETF and
ETR-memory trace data contents from RAM dumps.

Change-Id: Ie6f03bef7b4ccda7ea8d7709ee0c4808424c5b92
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:19:06 -07:00
Pratik Patel 5129fec5e2 coresight: sequence FFCR writes during __etb_disable
Instead of writing FFCR bits 12 and 6 at once, sequence them i.e.
write bit 12 first to set ETB to stop on flush and followed by
setting bit 6 to trigger manual flush.

This should avoid any possible race between flush completing
before bit 12 getting set.

Change-Id: I0567701d34cb33a35d6bd876636a296532b9e400
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:17:18 -07:00
Pratik Patel 0b4c8dc99d coresight: change STM ATID to allow concurrent trace sources
Change STM traceid from 3 to 16 so that ETM and STM can be used
concurrently if required. ATIDs 0 to 15 are reserved for ETM - one
for each core.

Change-Id: Ic51cf3b8baa9c22be69c952a20281b238750de5d
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:17:17 -07:00
Pratik Patel 45ca607a1d coresight: change to using smp call for etm enable/disable
Since we moved to separate enable nodes for each ETM, using pm_qos
to prevent power collapse of the target cpu while we enable or
disable ETM is less efficient and also susceptible to a race with
cpu hotplug.

Move to using smp call to enable and disable trace to avoid above
deficiencies with the newly re-structured code.

Change-Id: I65c726dbd6275af8db0d40db5034299287a02e91
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:17:16 -07:00
Pratik Patel be1b8f8a70 coresight: only use etm0 for populating configuration
With maxcpus=1, only core0 will be running with other cores in
reset until they are explicitly hotplugged on. To avoid reading
ETM registers for cores that are in reset during probe, use only
ETM0 for populating configuration info. For other ETM probes,
copy the info from ETM0.

Change-Id: I9ae4539b004956a026e919323413f9e3c7d5ba4a
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:17:15 -07:00
Pratik Patel b2addf4292 coresight: reserve memory for tmc etr carve out
Memory reservation is now required for carve outs. Add appropriate
memory reservation driver support for the TMC ETR carve out.

Change-Id: I31cda1317d31555b70a034eae4c6fdadacd36fdb
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:17:14 -07:00
Pratik Patel bb6bc5708e coresight: take care of tmc etr wrap around & offset calculation
Ensure that buffer pointer points to the right location while
trying to read TMC in ETR circular buffer mode when we wrap
around.

TMC in ETR circular buffer mode tracks the physical address
in the RWP register (in contrast to pure offsets). Hence
subtract it from the base physical address to get the offset.

Change-Id: Ice1170dcd63928dd8304c421800848e036386b88
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:17:13 -07:00
Pratik Patel 0ec789147a coresight: allow hardware events to feed into CTI input
Program STM to allow TRIGOUTHETE output (that feeds into the CTI input)
to be asserted when hardware events occur. Also program the STM sync
frequency to 1023 byte interval.

Change-Id: Ia4c9c73d61a50dfc5eb2df5f52921831b647df0e
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:17:13 -07:00
Pratik Patel 1fa14e959e coresight: support for etr to usb output
Support for etr to usb trace output using QDSS BAM to USB BAM
transfers.

Change-Id: Ibb6f8d0cf1d9799668cb22ccaa13966139c8dea5
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:17:07 -07:00
Pratik Patel 1847b5321c coresight: fix whitespace in coresight drivers
Add/remove whitespace to improve code readability.

Change-Id: Iade3100b7eb9a57f95849d6665257cffe85b26b3
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:08:57 -07:00
Pratik Patel a3d7bad3d9 coresight: krait pass3 support for etm driver
Bottom 8 bits [7:0] of ETMSYNCFR are reserved on Krait pass3. This
means only bits [11:8] are valid since bits [31:12] are specified
as reserved by PFTv1.1 specification.

Use an appropriate value for the synchronization frequency in light
of this change on Krait pass3.

Change-Id: I5f32ad6546fc8a72e0a222cc90e0f23c9779ee3c
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:08:55 -07:00
Pratik Patel e39a7d87b4 coresight: implement stm hardware event and port enable sysfs nodes
Have STM hardware event and port enable sysfs nodes to allow users to
selectively enable and disable either hardware events or stimulus
ports while STM as a whole is enabled.

Change-Id: I32c23f62a3782487e67eb5e6a9da5a5bf7e11df8
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:08:43 -07:00
Pratik Patel 2cf0b0a1d7 coresight: implement coresight abort
Provide CoreSight abort debug api to stop the active trace sink
from any context. This is a best effort api that can be used to
abruptly stop and disable the current trace sink from anywhere
in the kernel to avoid tracing and hence polluting the trace data
after the point of interest has been executed.

Change-Id: I34c528d9febec4265088a7267dbcf0e7a1f87fcf
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:08:42 -07:00
Pratik Patel 1104f35e76 coresight: coresight tmc driver
This driver manages CoreSight TMC (Trace Memory Controller) which
can be pre-configured as an ETF (Embedded Trace FIFO) or ETR
(Embedded Trace Router). ETF when configured in circular buffer mode
acts as an ETB (Embedded Trace Buffer).

Change-Id: I1ca40e1fbd3049dc7addb834c064ab3a6c4c22e0
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:08:41 -07:00
Pratik Patel b98123a0a9 coresight: device tree support for coresight drivers
Support for reading hardware data for CoreSight devices from device
tree.

Change-Id: I4d149991c89b458384465d163386084f500a4028
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:08:32 -07:00
Pratik Patel 1d14fe6369 coresight: use devm apis in driver probe
Using devm_* apis helps in simplifying driver init and exit paths,
hence switch to using them in the driver probe calls.

Change-Id: I41aba1129f6638fcee859e57f957fa3f14c1c439
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:08:12 -07:00
Pratik Patel e6d0c465ae coresight: coresight replicator driver
This driver manages the CoreSight Replicator that has been made
programmable to allow software to turn of the replicator branch
to sink that is not being used. This avoids trace traffic to the
unused/non-current sink from causing backpressure that results in
overflows at the source.

Change-Id: Idf82149d5dc3702b6da59147e4d9d5e532032161
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:08:11 -07:00
Pratik Patel fa51345513 coresight: switch to use coresight core layer code
Switch all CoreSight drivers to start using the new CoreSight core
layer code. Remove obsolete qdss code.

Change-Id: I2d4496aea0ffd918e0bfbf4b4e58ad82ea634a59
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:07:49 -07:00
Pratik Patel 78653aca8c coresight: disable tpiu at init to support older targets
Some targets require tpiu is disabled before other sinks like ETB
get enabled to get proper ETM trace.

Change-Id: Idcacf7b6515fd17c3a49c74a338258f02631f7cc
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:04:26 -07:00
Pratik Patel 5f2822f800 coresight: sink switching support for coresight core layer code
This allows users to switch between available trace sinks thus
providing user to choose the best switch for the debug use case.

Change-Id: I0c90396010cfcd9f3ab9d3c6d4c1cc7230632c42
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 15:04:26 -07:00
Pratik Patel 63a0ab6fe4 coresight: rename variables and functions from cs to coresight
Complete the rename by changing cs to coresight for variables,
functions and constants.

Change-Id: I506d5872e5c09f201c4f3674d7722d36eca26921
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 14:58:31 -07:00
Pratik Patel 30700919f3 coresight: rename directory and files from cs to coresight
Since cs is not a well known acronym for CoreSight, rename
directory and files from cs to coresight.

Change-Id: I5f9b12794b80b1c01c9ce0621d53ee6be408a361
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
2013-09-04 14:58:31 -07:00