mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
clk: mediatek: add array size field for id_offs_map
Add id_offs_map_size field to struct mtk_clk_tree and populate it for all existing drivers. Currently, there is no bounds checking when accessing the id_offs_map array. Adding this field will allow for bounds checking in the future. Signed-off-by: David Lechner <dlechner@baylibre.com>
This commit is contained in:
@@ -996,6 +996,7 @@ static const struct mtk_gate hif_cgs[] = {
|
||||
static const struct mtk_clk_tree mt7623_apmixedsys_clk_tree = {
|
||||
.xtal2_rate = 26 * MHZ,
|
||||
.id_offs_map = pll_id_offs_map,
|
||||
.id_offs_map_size = ARRAY_SIZE(pll_id_offs_map),
|
||||
.plls = apmixed_plls,
|
||||
.num_plls = ARRAY_SIZE(apmixed_plls),
|
||||
};
|
||||
@@ -1003,6 +1004,7 @@ static const struct mtk_clk_tree mt7623_apmixedsys_clk_tree = {
|
||||
static const struct mtk_clk_tree mt7623_topckgen_clk_tree = {
|
||||
.xtal_rate = 26 * MHZ,
|
||||
.id_offs_map = top_id_offs_map,
|
||||
.id_offs_map_size = ARRAY_SIZE(top_id_offs_map),
|
||||
.fdivs_offs = top_id_offs_map[CLK_TOP_SYSPLL],
|
||||
.muxes_offs = top_id_offs_map[CLK_TOP_AXI_SEL],
|
||||
.fclks = top_fixed_clks,
|
||||
@@ -1063,6 +1065,7 @@ static int mt7623_infracfg_probe(struct udevice *dev)
|
||||
|
||||
static const struct mtk_clk_tree mt7623_clk_peri_tree = {
|
||||
.id_offs_map = peri_id_offs_map,
|
||||
.id_offs_map_size = ARRAY_SIZE(peri_id_offs_map),
|
||||
.muxes_offs = peri_id_offs_map[CLK_PERI_UART0_SEL],
|
||||
.gates_offs = peri_id_offs_map[CLK_PERI_NFI],
|
||||
.muxes = peri_muxes,
|
||||
|
||||
@@ -1360,6 +1360,7 @@ static const struct mtk_clk_tree mt8188_topckgen_clk_tree = {
|
||||
.xtal_rate = 26 * MHZ,
|
||||
.xtal2_rate = 26 * MHZ,
|
||||
.id_offs_map = mt8188_id_offs_map,
|
||||
.id_offs_map_size = ARRAY_SIZE(mt8188_id_offs_map),
|
||||
.fdivs_offs = 8, /* CLK_TOP_MAINPLL_D3 */
|
||||
.muxes_offs = 87, /* CLK_TOP_AXI */
|
||||
.fclks = top_fixed_clks,
|
||||
|
||||
@@ -252,6 +252,7 @@ struct mtk_clk_tree {
|
||||
* ID for factor, mux and gates.
|
||||
*/
|
||||
const int *id_offs_map; /* optional, table clk.h to driver ID */
|
||||
const int id_offs_map_size;
|
||||
const int fdivs_offs;
|
||||
const int muxes_offs;
|
||||
const int gates_offs;
|
||||
|
||||
Reference in New Issue
Block a user