summaryrefslogtreecommitdiff
path: root/drivers/ddr/altera
AgeCommit message (Collapse)Author
2015-08-08ddr: altera: Internal mem_calibrate() cleanup part 6Marek Vasut
Add kerneldoc to this function. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Internal mem_calibrate() cleanup part 5Marek Vasut
This is kind of microseries-within-series indent cleanup. Rework the code for the the middle-loop of the mega-loop this time and deal with the group_failed variable. Instead of checking if the group failed in the previous calibration part, just jump to the end of the loop if calibration did fail and increment the counter. This shaves away one more level of indent while making the code slightly more readable. It is likely that this patch has checkpatch warnings, but for the sake of not breaking the code, these are ignored. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Internal mem_calibrate() cleanup part 4Marek Vasut
This is kind of microseries-within-series indent cleanup. Rework the code for the last loop within the mega-loop to make it actually readable and not an insane cryptic pile of indent failure. It is likely that this patch has checkpatch warnings, but for the sake of not breaking the code, these are ignored. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Internal mem_calibrate() cleanup part 3Marek Vasut
This is kind of microseries-within-series indent cleanup. Rework the code for the third loop within the middle-loop of the mega-loop to make it actually readable and not an insane cryptic pile of indent failure. It is likely that this patch has checkpatch warnings, but for the sake of not breaking the code, these are ignored. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Internal mem_calibrate() cleanup part 2Marek Vasut
This is kind of microseries-within-series indent cleanup. Rework the code for the second loop within the middle-loop of the mega-loop to make it actually readable and not an insane cryptic pile of indent failure. It is likely that this patch has checkpatch warnings, but for the sake of not breaking the code, these are ignored. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Internal mem_calibrate() cleanup part 1Marek Vasut
This is kind of microseries-within-series indent cleanup. Rework the code for the first loop within the middle-loop of the mega-loop to make it actually readable and not an insane cryptic pile of indent failure. It is likely that this patch has checkpatch warnings, but for the sake of not breaking the code, these are ignored. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Trivial mem_calibrate() indent cleanupMarek Vasut
Redo the mega-condition such that if the calibration is to be skipped, the positive branch of the condition does all the work and returns. The negative branch, which is in fact the default behavior, is then converted to a code which is no longer conditional. This trims down the indent by one level. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Minor clean up of mem_skip_calibrate()Marek Vasut
Perform minor coding style cleanup of the mem_skip_calibrate() function, clean up comments and add kerneldoc. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up set_rank_and_odt_mask() part 3Marek Vasut
Clean up comments and add kerneldoc. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up set_rank_and_odt_mask() part 2Marek Vasut
Turn the big inner if (RW_MGR_MEM_NUMBER_OF_RANKS == ...) conditional into a switch {} statement instead. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up set_rank_and_odt_mask() part 1Marek Vasut
First, invert the logic of the if (odt_mode == ...) conditional to make the OFF mode harder to miss. It is a short piece of code right at the end, so move it up. Also, clean up data types and constify where applicable and clean up the cs_and_odt_mask assignment. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up mem_precharge_and_activate()Marek Vasut
Perform minor cleanup of this function, fix datatype and add kerneldoc. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up mem_config()Marek Vasut
Clean mem_config() function. First, reorder the math done in the function such that WLAT and RLAT computation is together. Then, scrap contradictory comments which do not match the result of the math at all. Next, extract the mem_precharge_and_activate() call from the end of the function as it is completely unrelated here. Finally, rename the function to mem_init_latency(). Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up phy_mgr_initialize()Marek Vasut
Zap the cryptic casts and rework the code into a slightly more readable form. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up run_mem_calibrate()Marek Vasut
Clean the function up slightly by using clrsetbits_le32() to flip bits in registers instead of cryptic bitmasks. Zap condition checking for PHY_DEBUG_IN_DEBUG_MODE flag, which is never set. Split the calibration report into separate debug_mem_calibrate() function. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Rename initialize() to phy_mgr_initialize()Marek Vasut
Just perform the rename to make the name more descriptive, no functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Init my_param and my_gblMarek Vasut
Init both structures with zeroes and zap all those zeroing shenanigans further down in the sdram_calibration_full(). Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Rework initialize_tracking()Marek Vasut
Clean the function up by getting rid of all the insane XOR-leftshift combos when assembling register values. While at it, remove all the ad-hoc variables necessary for this XOR-leftshift voodoo. Finally, get rid of the iterative division implementation of two constants and replace it with a DIV_ROUND_UP() macro :-) Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Fix ad-hoc iterative division implementationMarek Vasut
Contemporary CPUs can perform division just fine, use this functionality and zap another implementation of iterative division :-) Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Minor clean up of set_jump_as_return()Marek Vasut
Add kerneldoc and do a minor comment cleanup. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Factor out common codeMarek Vasut
Factor out almost common code from rw_mgr_mem_handoff() and rw_mgr_mem_initialize() into separate rw_mgr_mem_load_user(). No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Factor out instruction loading from rw_mgr_mem_initialize()Marek Vasut
Pull the duplicate code out into a separate function. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up scc_mgr_apply_group_all_out_delay_add_all_ranks()Marek Vasut
Zap unused group_bgn parameter, fix and constify data types. Document in kerneldoc. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Internal scc_mgr_apply_group_all_out_delay_add() cleanup part 2Marek Vasut
Clean the DQS and OCT parts of the function, clean up the chopped formatting strings in debug_cond() and slightly improve the code. Zap group_bgn argument as it is used only in debug messages. Document the function using kerneldoc. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Internal scc_mgr_apply_group_all_out_delay_add() cleanup part 1Marek Vasut
Apparently, in case of the DQ and DM, the value if the new_delay variable is calculated, but the value is not used. Zap the entire code which does calculate the value. It is not clear to me whether or not the code is doing the right thing in the first place. Right now, it calls scc_mgr_load_dq() and scc_mgr_load_dm() respectively, but I suspect it might need to call scc_mgr_apply_group_dq_out1_delay() and scc_mgr_apply_group_dm_out1_delay() instead. This is something Altera must investigate. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up scc_mgr_zero_group()Marek Vasut
First, zap unused argument of the function. Next, clean up the data types, constify where applicable, clean up comments and add kerneldoc. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up scc_mgr_zero_all()Marek Vasut
Add kerneldoc, clean up datatypes and fix minor indentation issue. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Extract scc_mgr_set_hhp_extras()Marek Vasut
Move scc_mgr_set_hhp_extras() out of scc_set_bypass_mode() as it has nothing to do in there. Instead, invoke it from mem_calibrate() just before invoking scc_set_bypass_mode(). Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up scc_mgr_set_hhp_extras()Marek Vasut
Minor coding style cleanup for this function. Furthermore, move ad-hoc debug_cond() calls from the only location from where this function is invoked into this actual function. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up scc_mgr_*_delay() argsMarek Vasut
Zap args which are not used by these functions, in particular the write_group is often passed, but unused. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up scc_mgr_apply_group_dq_out1_delay()Marek Vasut
Remove unused write_group and group_bgn argument from this function. Document the function using kerneldoc. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up scc_mgr_set_oct_out1_delay()Marek Vasut
Make this function more readable, no functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up scc_set_bypass_mode()Marek Vasut
The mode argument of this function is not used at all, zap it. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up scc_mgr_load_dqs_for_write_group()Marek Vasut
Make this function more readable, no functional change. Also, zap the forward declaration, which is no longer needed. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Implement universal scc_mgr_set_all_ranks()Marek Vasut
Implement universal scc_mgr_set_all_ranks() function and convert various ad-hoc implementations of similar functionality to use this single function. Document the function in kerneldoc. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Shuffle around scc_mgr_set_*all_ranks()Marek Vasut
Shuffle the code around a bit, but without any functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up scc_mgr_initialize()Marek Vasut
Clean up the comments and add kerneldoc. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Implement universal scc manager config functionMarek Vasut
Implement unified scc_mgr_set() function and convert all those 9 scc_mgr_set_*() ad-hoc functions to call this one function. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Reorder scc manager functionsMarek Vasut
This patch just puts functions which look similar next to each other, so they can be sorted out. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up scc manager function argsMarek Vasut
Clean up the unused args of the functions used to configure the SCC manager. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up reg_file_set*()Marek Vasut
Turn the insides of these functions into trivial clrsetbits_le32() and fix the data type of their argument to reflect it's actual size. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up initialize_hps_phy()Marek Vasut
Add brief kerneldoc. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up initialize_reg_file()Marek Vasut
Add brief kerneldoc. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Clean up hc_initialize_rom_data()Marek Vasut
Clean the function up, fix data types, add kerneldoc. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Massage addr into I/O accessorsMarek Vasut
Get rid of invocations of this sort: addr = (u32)&base->reg; writel(val, addr); Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Stop using SDR_CTRLGRP_ADDRESS directlyMarek Vasut
Use the proper structure which describes these registers, especially since this is already in place. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Wrap SOCFPGA_SDR_ADDRESS into SDR_PHYGRP.*ADDRESSMarek Vasut
Just trim down the constant SOCFPGA_SDR_ADDRESS + SDR_PHYGRP.*ADDRESS in the code. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Pluck out remaining sdr_get_addr() callsMarek Vasut
Remove the remaining invocations of sdr_get_addr() and the function itself. This makes the code a bit less cryptic. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Dissolve invocation of sdr_get_addr(&sdr_mgr_.*->.*)Marek Vasut
Instead of this indirection, just adjust the register pointer and directly use the register base address. Signed-off-by: Marek Vasut <marex@denx.de>
2015-08-08ddr: altera: Dissolve invocation of sdr_get_addr(&sdr_rw_load.*->.*)Marek Vasut
Instead of this indirection, just adjust the register pointer and directly use the register base address. Signed-off-by: Marek Vasut <marex@denx.de>