summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-tegra.c
AgeCommit message (Collapse)Author
2012-05-25spi: tegra: use functions to avoid duplicated codeLaxman Dewangan
The dma allocation method for receive and transmit is same and so instead of duplicating the same code for rx and tx, making the function to have common code and using the function for dma allocation. This reduces duplicated code. Change-Id: Ibe15eec896bc581bda8c68572eb1425c3bf6a7b2 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/104465 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2012-05-25spi: tegra: use devm_* for resource allocationLaxman Dewangan
Using of devm_* function for resource allocation does not require to free resource on code and hence it reduces code sizes. Change-Id: Id6f0ba3cde2f351d5668ed28b098e5a829716a30 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/104464 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2012-05-25spi: tegra: fix fifo_depth to 32.Laxman Dewangan
Slink controller have the fifo depth of 32 words in rx and tx side. But some of places it was taken the value as 4. Fixing this to 32 words. Change-Id: I262127c59241ce75d4385464c21ee733a48b1475 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/104463 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Stephen Warren <swarren@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2012-05-23spi: tegra: synchronize PPSB late writeLaxman Dewangan
When any write is made to PPSB register, it take time to actual happen in the register due to ARM-PPSB design. Delay or readback is required to make sure that write is completed. There is no worst case guaranteed delay and hence doing the register read to make write completes actually. Change-Id: Iefd25115e1a9f02c64e83f11a4e249ad9d086d16 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/102207 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2012-05-23spi: tegra: cleanup in runtime_pm implementation.Laxman Dewangan
Cleaning up runtime pm implementation for the driver. There is lots of duplicate code which is not require as it is handled in the runtime framework. Change-Id: I4494cdd3518cbcb90f24fb3387f38c9859b4f957 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/102206 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2012-05-18spi: tegra: correct directions when syncing buffer for device/dma.Laxman Dewangan
The Tx buffer to be synced with the direction of DMA_TO_DEVICE and Rx buffer should be synced with direction of DMA_FROM_DEVICE. bug 959947 Change-Id: I490a93e05723e3114c8ae3c640bb7eff23bcc75d Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/103095 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-05-18spi: tegra: register interrupt as ONESHOTLaxman Dewangan
The Tegra spi's engine is design as it generates interrupt when any error occurs and it keep transferring data. It does not stop the engine once error occurred and interrupt generated. This may cause reentry of ISR as on error case, isr get called where it clears interrupt and because it is still in progress, it again interrupts and schedule the thread. The second time scheduling of the isr/thread can cause the issue in queue management and sw state. So Making the interrupt as ONESHOT so that the interrupt will not get schedule until the engine is reset in error case. Change-Id: I96daaf50102aede93164c82b7f6da235d0a7fbfc Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/101547 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Jui Chang Kuo <jckuo@nvidia.com> Tested-by: Jui Chang Kuo <jckuo@nvidia.com>
2012-04-05spi: tegra: Use tegra_dma_cancel() to abort requestLaxman Dewangan
To terminate request from dma, use the tegra_dma_cancel() inplace of tegra_dma_dequeue(). The api tegra_dma_dequeue() is getting to be obsolete. Change-Id: I297e67433a2118377ecb9b028dcf8fa82e09f0e2 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/91752 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Ashwini Ghuge <aghuge@nvidia.com> Tested-by: Ashwini Ghuge <aghuge@nvidia.com>
2012-03-15spi: tegra: Make sure SCLK frequency to be in minimum require value.Laxman Dewangan
Making sure that SCLK frequency should be maintain on minimum require value during spi transfer. This is require to proper functioning of spi controller. bug 949393 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/89526 Cherry-picked from commit 7d83f658b39b2ab1a5105eec7649246fddea7325 Change-Id: I60fa0fef98e5f2882c646c29e1773194deddd6da Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/90296 Reviewed-by: Automatic_Commit_Validation_User
2012-03-01spi: tegra: Fix CS status properly in spi setupLaxman Dewangan
Fixing the logic to clear/set spi cs level on default command register. Change-Id: I55e130ecb02dae6e11ad7048730ed11df9848e94 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/86888 Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
2012-02-23spi: tegra: checkpatch cleanupsLaxman Dewangan
Removing checkpatch error and warnings from spi driver resulted from checkpatch. Change-Id: I92160e802781b583048f46a93dee7d2465689cc0 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/85163 Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2012-02-23spi: tegra: Add Dma/cpu buffer synchronisationLaxman Dewangan
When dma coherant buffer need to be access by cpu or apb dma, it is require to calling the dma_sync_single_for_cpu() when cpu wants to access it and dma_sync_single_for_device() when dma wants to access the buffer. Change-Id: I62fc7fced782f3fc2d145c0d5416a4c8cbe30715 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/85138 Reviewed-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
2012-02-03spi: tegra: dequeue dma req using tegra_dma_dequeue_req()Laxman Dewangan
The dma client should use the tegra_dma_dequeue_req() for dequeue the dma request. Change-Id: I1f433c85ffec997d8c608e08509c48c72b27120a Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/77804 Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com> Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
2012-01-31spi: tegra: use run time pm apis for clock controlLaxman Dewangan
Used run time apis for clock controls i.e. clock enable/ disable in place of direct clock apis. Using of runtime pm api was already implemented but it was missed on probe where it was calling clock_disable. Fixing this issue. bug 928541 Change-Id: I511467bd1cbe05f2a05d219d19236426a30d05d5 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/78156 Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com> Reviewed-by: Ashwini Ghuge <aghuge@nvidia.com>
2012-01-13drivers: spi: tegra: Add runtime PM supportAshwini Ghuge
Bug 886806 Original commit: http://git-master/r/59905 Change-Id: Ia8d64f3810d6157c6029180cd9a3cf98c2d3cb4c Signed-off-by: Ashwini Ghuge <aghuge@nvidia.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/74896 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com>
2011-12-30SPI: tegra: Pass rx data only to req bit lengthVarun Wadekar
When fifo is read, it can contain valid data bits and random bits in rest of the fifo. Reading only valid bits from fifo and resetting rest to zero before sending to client. Change-Id: I961279048aada6087b323ab6730bf72706730917 Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com> Reviewed-on: http://git-master/r/70534 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2011-11-30HACK merge fixups for compileDan Willemsen
Rebase-Id: Rbc628711479b187a90437bea94776066c7a58b54
2011-11-30spi: tegra: Move clock controls api out of spin lockLaxman Dewangan
The clock control apis can be sleepable in tegra platform as spi require frequency/voltage boosting. Moving the clock controls api out of spin lock context. bug 874841 Reviewed-on: http://git-master/r/56869 (cherry picked from commit b316a4e4fd82f1af9af920079119c56bf271c3be) Change-Id: I8fc824de02cb3af54f6331efa0500c79e806bb03 Reviewed-on: http://git-master/r/57315 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com> Rebase-Id: R601bd69547ec2612f42d24da29a2f8a5d3fb1fb8
2011-11-30spi: tegra: Handles suspend when spi transfer is in progressLaxman Dewangan
Avoiding the suspend of the system if the spi transfer is in progress for current transfer queue. bug 864987 Reviewed-on: http://git-master/r/56599 (cherry picked from commit 0ba8ed371f2937a095752a0edbc15ed75664644a) Change-Id: Ife7ae8a7d66a66d047ee2c8829d16017571b4d58 Reviewed-on: http://git-master/r/57001 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Tested-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Bitan Biswas <bbiswas@nvidia.com> Rebase-Id: Rc66d6c7ae51ea6709d5e47331fef30c87029b343
2011-11-30spi: tegra: Select best clock source for required rateLaxman Dewangan
Providing the different clock source option through platform data to select best clock source based on required interface frequency. bug 851642 Original-Change-Id: I18bf817b63cf1afac7db3969f266cc5fcaeee81e Reviewed-on: http://git-master/r/41226 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Aleksandr Frid <afrid@nvidia.com> Tested-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Bitan Biswas <bbiswas@nvidia.com> Rebase-Id: Ra4e4573414ef2c4e72cdcb4cd5625e242cfb4ec6
2011-11-30spi: tegra: fix uninitialized values and if statementJubeom Kim
- Initialized the read_words value. - (tspi->irq < 0) is not valid because tspi->irq is unsigned value. Reviewed-on: http://git-master/r/37868 (cherry picked from commit 4c0d22c83294ca081e90f588fdcb67fdc54fff23) Original-Change-Id: Ic37df9d29e305699abeda1f8b8aa48b7fcd9b394 Reviewed-on: http://git-master/r/39583 Tested-by: Jubeom Kim <jubeomk@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: R8e088031295c334cf3026ee8a49738605b7fcf7f
2011-11-30arm: tegra: Clean up SOC conditionalsScott Williams
Change SOC conditionals to make them more forward-looking. Original-Change-Id: Ib60db4e690c2f396afdec962616d735548b5a8a9 Reviewed-on: http://git-master/r/32706 Reviewed-by: Niket Sirsi <nsirsi@nvidia.com> Tested-by: Niket Sirsi <nsirsi@nvidia.com> Rebase-Id: Ra0885f203904e0bd4bdd06c23b6aa7e03e7ec3bc
2011-11-30arm: tegra: dma: Adding client name with dma allocation.Laxman Dewangan
By changing the dma allocation API to take the client name, it is easy to track who is allocated the DMA channels when we run out of the DMA channels. Original-Change-Id: I016011cfd74089fed0da1bc0f121800017ce124a Reviewed-on: http://git-master/r/28031 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com> Original-Change-Id: I048bcb87f95ee6d8ad2fdce993a1758dc5071666 Rebase-Id: R29b9645ecbe209f571018c6e707bfdd9cd65ad5d
2011-11-30spi: tegra: Spi controller configured during device setupLaxman Dewangan
When spi device calls the setup, the interface to that device should be configured immediately. For this, it is required to configure controller in setup call. Original-Change-Id: I77795c476729fe7403529a45cdf99d5732ad0784 Reviewed-on: http://git-master/r/27607 Reviewed-by: Niket Sirsi <nsirsi@nvidia.com> Tested-by: Niket Sirsi <nsirsi@nvidia.com> Original-Change-Id: I9a3f200dbea7d8cc057bb5413e790c28578e77cf Rebase-Id: R7e9907797bf951a9f7b9b6db0a440b3796dc977c
2011-11-30ARM: tegra: Use proper type for physical addressesScott Williams
Original-Change-Id: I158d2be97c795313e7e74ce9fb4ec0bdc7d95496 Reviewed-on: http://git-master/r/27559 Tested-by: Scott Williams <scwilliams@nvidia.com> Reviewed-by: Hiro Sugawara <hsugawara@nvidia.com> Reviewed-by: Jin Qian <jqian@nvidia.com> Reviewed-by: Kaz Fukuoka <kfukuoka@nvidia.com> Reviewed-by: Scott Williams <scwilliams@nvidia.com> Original-Change-Id: I0ff198daa548ed2837f7fb1794013bf0adf7e5a1 Rebase-Id: R61892d66dc9efd02f691a3ac75f92dd5d6d17078
2011-11-30spi: tegra: Supporting HW based CS controlLaxman Dewangan
Supporting the hw based CS to communicate to spi device. This provides the constraints in hold and setup time of CS before clock start and clock ends. The hw based CS can be selected if spi client provide the option through the device controler data and only one transfer per message is requested. Original-Change-Id: I56d5e466361cb8b3710646e01494ddac46791ae4 Reviewed-on: http://git-master/r/23988 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Tested-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Amit Kamath <akamath@nvidia.com> Reviewed-by: Ramachandrudu Kandhala <rkandhala@nvidia.com> Original-Change-Id: I52b1dcdefa199cd11ae7f838c61411a6268a2d32 Rebase-Id: Rd9f2c70e8c8551ea5ca6ce698a172ef00c08ca67
2011-11-30spi: tegra: Fixing misc issues.Laxman Dewangan
Following are the fixes; - Supportng half duplex. - Only using SW based CS. - Write to readback with command register does not work. Fixing issue. - Using cpu based transfer for smaller size and dma based for larger size. - reading proper transfer status after every transaction. bug 791149 bug 791780 Original-Change-Id: I293b3f1b571276f5d8fe4ad4da67f827926e4b73 Reviewed-on: http://git-master/r/20581 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Tested-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-by: Amit Kamath <akamath@nvidia.com> Rebase-Id: R29f88f7509bdb182f05916ecf31e1090b1b9d017
2011-11-30spi: tegra: disabling packed modeAmit Kamath
disable unstable packed spi mode Original-Change-Id: I81a11a0f5dd9515ff1430ccfcc7d2ed7371e79b3 Reviewed-on: http://git-master/r/16105 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com> Rebase-Id: R010fbce5f63a377fa9661f3bdd89523c497989ec
2011-11-30[ARM] tegra: spi: Fixed setup bugsAmit Kamath
Enabled clocks at spi_setup Fixed problem with endianness for 16 bit word size Fixed issue with small packet size less than fifo depth Fixed typo that enabled RX and TX by default Integration from http://git-master/r/#change,14536 Original-Change-Id: I2cea3bdcb6a19780087671131a848095354105a3 Reviewed-on: http://git-master/r/15949 Reviewed-on: http://git-master/r/16048 Reviewed-by: Amit Kamath <akamath@nvidia.com> Tested-by: Amit Kamath <akamath@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: Ra7c9c381f2ae897d002853c9965252ba28dc28ac
2011-11-30[tegra:spi] master tegra spi driver updateminwuklee
- DMA burst size can be set to 1, 4, or 8 depending on requested size - PACKED MODE support - When bits per word is 32, no endian conversion is needed; so use memcpy to copy from client buf to dma buf or vice versa - Do spi_complete operation in the last dma complete callback - Reducing the loop-count from 500 to 50, thus making sure suspend is not stuck. bug 747979 bug 765062 Original-Change-Id: I67fe1405e1cda886e9229b26dff5ebd80fd67247 Reviewed-on: http://git-master/r/12799 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: R34ee80275312587666359ed2e0e8dab468068daf
2011-11-30[tegra:dma] set dma burst size for spi/slinkminwuklee
for spi/slink, depending on transfer size, burst size can be set to 1, 4, or 8. bug 747979 Original-Change-Id: Ieae0285d374e7d0eb6c2c2e633f8cafbb2b51b3a Reviewed-on: http://git-master/r/12076 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: R366881cc8a4ba50cdd815b97f52b4e7d4dfb1ee6
2011-11-30[tegra:dma] set dma burst size for spi/slinkminwuklee
for spi/slink, set dma burst size based on transfer size. bug 747979 Original-Change-Id: I8c3c0a0410648a25190847590b9ac0304fb1105f Reviewed-on: http://git-master/r/11752 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: R63f68e541c427778a412c5f09e656fb18da5f05d
2011-11-30spi: tegra: Use shared DMA channelColin Cross
To avoid running out of DMA channels, use the shared DMA channel for all four Tegra spi controllers. Change-Id: Iff644253cf7fae36aa2e42321a1ded35a728da4f Signed-off-by: Colin Cross <ccross@android.com>
2011-11-30spi: tegra: Increase delay between CS and clock startGreg Meiste
Some SPI devices require a delay between the CS and when the clock starts. Increase SS_SETUP to accommodate these devices. Change-Id: I301e3583e70c722cadde5a9f91119881805dd3a5 Signed-off-by: Greg Meiste <w30289@motorola.com>
2011-11-30[ARM] Tegra: SPI: Suspend/resume.Todd Poynor
Save/restore SLINK_COMMAND_0 register. Wait for in-progress transactions to complete before suspend. Reject and WARN_ON transactions when suspended. Change-Id: I0527781f0bf95781afa3a35a68282cde2f0189ae Signed-off-by: Todd Poynor <toddpoynor@google.com>
2011-07-05spi/tegra: Use engineering names in DT compatible propertyStephen Warren
Engineering names are more stable than marketing names. Hence, use them for Device Tree compatible properties instead. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-06-15gpio/tegra: Move Tegra gpio driver to drivers/gpioGrant Likely
As part of the gpio driver consolidation, this patch moves the Tegra driver into drivers/gpio Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-06-10spi: Convert uses of struct resource * to resource_size(ptr)Joe Perches
Done via coccinelle scripts like: @@ struct resource *ptr; @@ - ptr->end - ptr->start + 1 + resource_size(ptr) and some grep and typing. Mostly uncompiled, no cross-compilers. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-06-06spi: reorganize driversGrant Likely
Sort the SPI makefile and enforce the naming convention spi_*.c for spi drivers. This change also rolls the contents of atmel_spi.h into the .c file since there is only one user of that particular include file. v2: - Use 'spi-' prefix instead of 'spi_' to match what seems to be be the predominant pattern for subsystem prefixes. - Clean up filenames in Kconfig and header comment blocks Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Linus Walleij <linus.walleij@linaro.org>