// SPDX-License-Identifier: GPL-2.0-or-later /* * OpenFirmware helpers for memory drivers * * Copyright (C) 2012 Texas Instruments, Inc. * Copyright (C) 2019 Samsung Electronics Co., Ltd. * Copyright (C) 2020 Krzysztof Kozlowski <[email protected]> */ #include <linux/device.h> #include <linux/of.h> #include <linux/gfp.h> #include <linux/export.h> #include "jedec_ddr.h" #include "of_memory.h" /** * of_get_min_tck() - extract min timing values for ddr * @np: pointer to ddr device tree node * @dev: device requesting for min timing values * * Populates the lpddr2_min_tck structure by extracting data * from device tree node. Returns a pointer to the populated * structure. If any error in populating the structure, returns * default min timings provided by JEDEC. */ const struct lpddr2_min_tck *of_get_min_tck(struct device_node *np, struct device *dev) { … } EXPORT_SYMBOL(…); static int of_do_get_timings(struct device_node *np, struct lpddr2_timings *tim) { … } /** * of_get_ddr_timings() - extracts the ddr timings and updates no of * frequencies available. * @np_ddr: Pointer to ddr device tree node * @dev: Device requesting for ddr timings * @device_type: Type of ddr(LPDDR2 S2/S4) * @nr_frequencies: No of frequencies available for ddr * (updated by this function) * * Populates lpddr2_timings structure by extracting data from device * tree node. Returns pointer to populated structure. If any error * while populating, returns default timings provided by JEDEC. */ const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr, struct device *dev, u32 device_type, u32 *nr_frequencies) { … } EXPORT_SYMBOL(…); /** * of_lpddr3_get_min_tck() - extract min timing values for lpddr3 * @np: pointer to ddr device tree node * @dev: device requesting for min timing values * * Populates the lpddr3_min_tck structure by extracting data * from device tree node. Returns a pointer to the populated * structure. If any error in populating the structure, returns NULL. */ const struct lpddr3_min_tck *of_lpddr3_get_min_tck(struct device_node *np, struct device *dev) { … } EXPORT_SYMBOL(…); static int of_lpddr3_do_get_timings(struct device_node *np, struct lpddr3_timings *tim) { … } /** * of_lpddr3_get_ddr_timings() - extracts the lpddr3 timings and updates no of * frequencies available. * @np_ddr: Pointer to ddr device tree node * @dev: Device requesting for ddr timings * @device_type: Type of ddr * @nr_frequencies: No of frequencies available for ddr * (updated by this function) * * Populates lpddr3_timings structure by extracting data from device * tree node. Returns pointer to populated structure. If any error * while populating, returns NULL. */ const struct lpddr3_timings *of_lpddr3_get_ddr_timings(struct device_node *np_ddr, struct device *dev, u32 device_type, u32 *nr_frequencies) { … } EXPORT_SYMBOL(…); /** * of_lpddr2_get_info() - extracts information about the lpddr2 chip. * @np: Pointer to device tree node containing lpddr2 info * @dev: Device requesting info * * Populates lpddr2_info structure by extracting data from device * tree node. Returns pointer to populated structure. If error * happened while populating, returns NULL. If property is missing * in a device-tree, then the corresponding value is set to -ENOENT. */ const struct lpddr2_info *of_lpddr2_get_info(struct device_node *np, struct device *dev) { … } EXPORT_SYMBOL(…);