mbox series

[v4,0/2] memory: Introduce ti-emif-sram driver

Message ID 20170927000355.30597-1-d-gerlach@ti.com
Headers show
Series memory: Introduce ti-emif-sram driver | expand

Message

Dave Gerlach Sept. 27, 2017, 12:03 a.m. UTC
Hi,
This is v4 of the series introduces a ti-emif-sram driver to be used on
am335x and am437x, based on v4.14-rc1. This version addresses some
comments from Russell King and Johan Hovold in v3 found here [1].

The main change in this version is dropping the additions to the
arch/arm/kernel/asm-offsets.c file and instead generating our own local
"emif-asm-offsets.h" using the same strategy in the drivers/memory Makefile.
This keeps our driver changes out of the arch or platform code and is a
cleaner implementation. Otherwise some small fixups based on comments from
Johan in v3 were done.

This code is required for low-power modes to work on AM335x and AM437x and a
forthcoming PM series for those platforms will depend on this series. After
both this and the PM series are reviewed I will send the necessary device tree
changes for both, but in the meantime all remaining patches for am335x and
am437x PM can be found here [2].

Regards,
Dave

[1] https://www.spinics.net/lists/linux-omap/msg138314.html
[2] https://github.com/dgerlach/linux-pm/tree/upstream/v4.14/amx3-suspend-v4

Dave Gerlach (2):
  Documentation: dt: Update ti,emif bindings
  memory: ti-emif-sram: introduce relocatable suspend/resume handlers

 .../bindings/memory-controllers/ti/emif.txt        |  18 +-
 drivers/memory/.gitignore                          |   1 +
 drivers/memory/Kconfig                             |  10 +
 drivers/memory/Makefile                            |  20 ++
 drivers/memory/emif-asm-offsets.c                  |  22 ++
 drivers/memory/emif.h                              |  17 ++
 drivers/memory/ti-emif-pm.c                        | 339 +++++++++++++++++++++
 drivers/memory/ti-emif-sram-pm.S                   | 334 ++++++++++++++++++++
 include/linux/ti-emif-sram.h                       | 148 +++++++++
 9 files changed, 908 insertions(+), 1 deletion(-)
 create mode 100644 drivers/memory/.gitignore
 create mode 100644 drivers/memory/emif-asm-offsets.c
 create mode 100644 drivers/memory/ti-emif-pm.c
 create mode 100644 drivers/memory/ti-emif-sram-pm.S
 create mode 100644 include/linux/ti-emif-sram.h

-- 
2.13.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Dave Gerlach Oct. 2, 2017, 3:34 p.m. UTC | #1
Russell,
On 09/28/2017 03:38 AM, Russell King - ARM Linux wrote:
> On Tue, Sep 26, 2017 at 07:03:55PM -0500, Dave Gerlach wrote:

>> diff --git a/drivers/memory/emif-asm-offsets.c b/drivers/memory/emif-asm-offsets.c

>> new file mode 100644

>> index 000000000000..bdb153c9e948

>> --- /dev/null

>> +++ b/drivers/memory/emif-asm-offsets.c

>> @@ -0,0 +1,22 @@

>> +/*

>> + * TI AM33XX EMIF PM Assembly Offsets

>> + *

>> + * Copyright (C) 2016-2017 Texas Instruments Inc.

>> + *

>> + * This program is free software; you can redistribute it and/or

>> + * modify it under the terms of the GNU General Public License as

>> + * published by the Free Software Foundation version 2.

>> + *

>> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any

>> + * kind, whether express or implied; without even the implied warranty

>> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

>> + * GNU General Public License for more details.

>> + */

>> +#include <linux/ti-emif-sram.h>

>> +

>> +int main(void)

>> +{

>> +	ti_emif_offsets();

>> +

>> +	return 0;

>> +}

> 

> ...

> 

>> +#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)

>> +static inline void ti_emif_offsets(void)

>> +{

>> +	DEFINE(EMIF_SDCFG_VAL_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_sdcfg_val));

>> +	DEFINE(EMIF_TIMING1_VAL_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_timing1_val));

>> +	DEFINE(EMIF_TIMING2_VAL_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_timing2_val));

>> +	DEFINE(EMIF_TIMING3_VAL_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_timing3_val));

>> +	DEFINE(EMIF_REF_CTRL_VAL_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_ref_ctrl_val));

>> +	DEFINE(EMIF_ZQCFG_VAL_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_zqcfg_val));

>> +	DEFINE(EMIF_PMCR_VAL_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_pmcr_val));

>> +	DEFINE(EMIF_PMCR_SHDW_VAL_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_pmcr_shdw_val));

>> +	DEFINE(EMIF_RD_WR_LEVEL_RAMP_CTRL_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_rd_wr_level_ramp_ctrl));

>> +	DEFINE(EMIF_RD_WR_EXEC_THRESH_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_rd_wr_exec_thresh));

>> +	DEFINE(EMIF_COS_CONFIG_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_cos_config));

>> +	DEFINE(EMIF_PRIORITY_TO_COS_MAPPING_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_priority_to_cos_mapping));

>> +	DEFINE(EMIF_CONNECT_ID_SERV_1_MAP_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_connect_id_serv_1_map));

>> +	DEFINE(EMIF_CONNECT_ID_SERV_2_MAP_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_connect_id_serv_2_map));

>> +	DEFINE(EMIF_OCP_CONFIG_VAL_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_ocp_config_val));

>> +	DEFINE(EMIF_LPDDR2_NVM_TIM_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_lpddr2_nvm_tim));

>> +	DEFINE(EMIF_LPDDR2_NVM_TIM_SHDW_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_lpddr2_nvm_tim_shdw));

>> +	DEFINE(EMIF_DLL_CALIB_CTRL_VAL_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_dll_calib_ctrl_val));

>> +	DEFINE(EMIF_DLL_CALIB_CTRL_VAL_SHDW_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_dll_calib_ctrl_val_shdw));

>> +	DEFINE(EMIF_DDR_PHY_CTLR_1_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_ddr_phy_ctlr_1));

>> +	DEFINE(EMIF_EXT_PHY_CTRL_VALS_OFFSET,

>> +	       offsetof(struct emif_regs_amx3, emif_ext_phy_ctrl_vals));

>> +	DEFINE(EMIF_REGS_AMX3_SIZE, sizeof(struct emif_regs_amx3));

>> +

>> +	BLANK();

>> +

>> +	DEFINE(EMIF_PM_BASE_ADDR_VIRT_OFFSET,

>> +	       offsetof(struct ti_emif_pm_data, ti_emif_base_addr_virt));

>> +	DEFINE(EMIF_PM_BASE_ADDR_PHYS_OFFSET,

>> +	       offsetof(struct ti_emif_pm_data, ti_emif_base_addr_phys));

>> +	DEFINE(EMIF_PM_CONFIG_OFFSET,

>> +	       offsetof(struct ti_emif_pm_data, ti_emif_sram_config));

>> +	DEFINE(EMIF_PM_REGS_VIRT_OFFSET,

>> +	       offsetof(struct ti_emif_pm_data, regs_virt));

>> +	DEFINE(EMIF_PM_REGS_PHYS_OFFSET,

>> +	       offsetof(struct ti_emif_pm_data, regs_phys));

>> +	DEFINE(EMIF_PM_DATA_SIZE, sizeof(struct ti_emif_pm_data));

>> +

>> +	BLANK();

>> +

>> +	DEFINE(EMIF_PM_SAVE_CONTEXT_OFFSET,

>> +	       offsetof(struct ti_emif_pm_functions, save_context));

>> +	DEFINE(EMIF_PM_RESTORE_CONTEXT_OFFSET,

>> +	       offsetof(struct ti_emif_pm_functions, restore_context));

>> +	DEFINE(EMIF_PM_ENTER_SR_OFFSET,

>> +	       offsetof(struct ti_emif_pm_functions, enter_sr));

>> +	DEFINE(EMIF_PM_EXIT_SR_OFFSET,

>> +	       offsetof(struct ti_emif_pm_functions, exit_sr));

>> +	DEFINE(EMIF_PM_ABORT_SR_OFFSET,

>> +	       offsetof(struct ti_emif_pm_functions, abort_sr));

>> +	DEFINE(EMIF_PM_FUNCTIONS_SIZE, sizeof(struct ti_emif_pm_functions));

>> +}

>> +#else

>> +static inline void ti_emif_offsets(void) {}

>> +#endif

> 

> Any reason the above can't be part of emif-asm-offsets.c ?

> 


Yes that's a good point. I was focused on moving the macros and didn't think
about why I hid everything away in the header in the first place, to avoid
cluttering the global asm-offsets.c. Now that we have our own file there's no
reason for this, I will fix this and the kbuild robot issue and send v5. I can
simplify the makefile more which will avoid that build error.

Regards,
Dave
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html