Lines Matching +full:endpoint +full:- +full:base

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
28 void __iomem *base; in dp_ioremap() local
30 base = devm_platform_get_and_ioremap_resource(pdev, idx, &res); in dp_ioremap()
31 if (!IS_ERR(base)) in dp_ioremap()
34 return base; in dp_ioremap()
39 struct platform_device *pdev = parser->pdev; in dp_parser_ctrl_res()
40 struct dp_io *io = &parser->io; in dp_parser_ctrl_res()
41 struct dss_io_data *dss = &io->dp_controller; in dp_parser_ctrl_res()
43 dss->ahb.base = dp_ioremap(pdev, 0, &dss->ahb.len); in dp_parser_ctrl_res()
44 if (IS_ERR(dss->ahb.base)) in dp_parser_ctrl_res()
45 return PTR_ERR(dss->ahb.base); in dp_parser_ctrl_res()
47 dss->aux.base = dp_ioremap(pdev, 1, &dss->aux.len); in dp_parser_ctrl_res()
48 if (IS_ERR(dss->aux.base)) { in dp_parser_ctrl_res()
51 * support variation in the sub-region sizes this was split. in dp_parser_ctrl_res()
52 * dp_ioremap() will fail with -EINVAL here if only a single in dp_parser_ctrl_res()
53 * reg is specified, so fill in the sub-region offsets and in dp_parser_ctrl_res()
56 if (PTR_ERR(dss->aux.base) == -EINVAL) { in dp_parser_ctrl_res()
57 if (dss->ahb.len < DP_DEFAULT_P0_OFFSET + DP_DEFAULT_P0_SIZE) { in dp_parser_ctrl_res()
59 return -EINVAL; in dp_parser_ctrl_res()
62 dss->ahb.len = DP_DEFAULT_AHB_SIZE; in dp_parser_ctrl_res()
63 dss->aux.base = dss->ahb.base + DP_DEFAULT_AUX_OFFSET; in dp_parser_ctrl_res()
64 dss->aux.len = DP_DEFAULT_AUX_SIZE; in dp_parser_ctrl_res()
65 dss->link.base = dss->ahb.base + DP_DEFAULT_LINK_OFFSET; in dp_parser_ctrl_res()
66 dss->link.len = DP_DEFAULT_LINK_SIZE; in dp_parser_ctrl_res()
67 dss->p0.base = dss->ahb.base + DP_DEFAULT_P0_OFFSET; in dp_parser_ctrl_res()
68 dss->p0.len = DP_DEFAULT_P0_SIZE; in dp_parser_ctrl_res()
70 DRM_ERROR("unable to remap aux region: %pe\n", dss->aux.base); in dp_parser_ctrl_res()
71 return PTR_ERR(dss->aux.base); in dp_parser_ctrl_res()
74 dss->link.base = dp_ioremap(pdev, 2, &dss->link.len); in dp_parser_ctrl_res()
75 if (IS_ERR(dss->link.base)) { in dp_parser_ctrl_res()
76 DRM_ERROR("unable to remap link region: %pe\n", dss->link.base); in dp_parser_ctrl_res()
77 return PTR_ERR(dss->link.base); in dp_parser_ctrl_res()
80 dss->p0.base = dp_ioremap(pdev, 3, &dss->p0.len); in dp_parser_ctrl_res()
81 if (IS_ERR(dss->p0.base)) { in dp_parser_ctrl_res()
82 DRM_ERROR("unable to remap p0 region: %pe\n", dss->p0.base); in dp_parser_ctrl_res()
83 return PTR_ERR(dss->p0.base); in dp_parser_ctrl_res()
87 io->phy = devm_phy_get(&pdev->dev, "dp"); in dp_parser_ctrl_res()
88 if (IS_ERR(io->phy)) in dp_parser_ctrl_res()
89 return PTR_ERR(io->phy); in dp_parser_ctrl_res()
96 struct device_node *endpoint; in dp_parser_link_frequencies() local
100 endpoint = of_graph_get_endpoint_by_regs(of_node, 1, 0); /* port@1 */ in dp_parser_link_frequencies()
101 if (!endpoint) in dp_parser_link_frequencies()
104 cnt = of_property_count_u64_elems(endpoint, "link-frequencies"); in dp_parser_link_frequencies()
107 of_property_read_u64_index(endpoint, "link-frequencies", in dp_parser_link_frequencies()
108 cnt - 1, &frequency); in dp_parser_link_frequencies()
109 of_node_put(endpoint); in dp_parser_link_frequencies()
120 struct device_node *of_node = parser->pdev->dev.of_node; in dp_parser_misc()
124 * data-lanes is the property of dp_out endpoint in dp_parser_misc()
128 /* legacy code, data-lanes is the property of mdss_dp node */ in dp_parser_misc()
133 parser->max_dp_lanes = cnt; in dp_parser_misc()
135 parser->max_dp_lanes = DP_MAX_NUM_DP_LANES; /* 4 lanes */ in dp_parser_misc()
137 parser->max_dp_link_rate = dp_parser_link_frequencies(of_node); in dp_parser_misc()
138 if (!parser->max_dp_link_rate) in dp_parser_misc()
139 parser->max_dp_link_rate = DP_LINK_RATE_HBR2; in dp_parser_misc()
155 struct device *dev = &parser->pdev->dev; in dp_parser_init_clk_data()
156 struct dss_module_power *core_power = &parser->mp[DP_CORE_PM]; in dp_parser_init_clk_data()
157 struct dss_module_power *ctrl_power = &parser->mp[DP_CTRL_PM]; in dp_parser_init_clk_data()
158 struct dss_module_power *stream_power = &parser->mp[DP_STREAM_PM]; in dp_parser_init_clk_data()
160 num_clk = of_property_count_strings(dev->of_node, "clock-names"); in dp_parser_init_clk_data()
163 return -EINVAL; in dp_parser_init_clk_data()
167 rc = of_property_read_string_index(dev->of_node, in dp_parser_init_clk_data()
168 "clock-names", i, &clk_name); in dp_parser_init_clk_data()
185 return -EINVAL; in dp_parser_init_clk_data()
188 core_power->num_clk = core_clk_count; in dp_parser_init_clk_data()
189 core_power->clocks = devm_kcalloc(dev, in dp_parser_init_clk_data()
190 core_power->num_clk, sizeof(struct clk_bulk_data), in dp_parser_init_clk_data()
192 if (!core_power->clocks) in dp_parser_init_clk_data()
193 return -ENOMEM; in dp_parser_init_clk_data()
198 return -EINVAL; in dp_parser_init_clk_data()
201 ctrl_power->num_clk = ctrl_clk_count; in dp_parser_init_clk_data()
202 ctrl_power->clocks = devm_kcalloc(dev, in dp_parser_init_clk_data()
203 ctrl_power->num_clk, sizeof(struct clk_bulk_data), in dp_parser_init_clk_data()
205 if (!ctrl_power->clocks) { in dp_parser_init_clk_data()
206 ctrl_power->num_clk = 0; in dp_parser_init_clk_data()
207 return -ENOMEM; in dp_parser_init_clk_data()
213 return -EINVAL; in dp_parser_init_clk_data()
216 stream_power->num_clk = stream_clk_count; in dp_parser_init_clk_data()
217 stream_power->clocks = devm_kcalloc(dev, in dp_parser_init_clk_data()
218 stream_power->num_clk, sizeof(struct clk_bulk_data), in dp_parser_init_clk_data()
220 if (!stream_power->clocks) { in dp_parser_init_clk_data()
221 stream_power->num_clk = 0; in dp_parser_init_clk_data()
222 return -ENOMEM; in dp_parser_init_clk_data()
235 struct device *dev = &parser->pdev->dev; in dp_parser_clock()
236 struct dss_module_power *core_power = &parser->mp[DP_CORE_PM]; in dp_parser_clock()
237 struct dss_module_power *ctrl_power = &parser->mp[DP_CTRL_PM]; in dp_parser_clock()
238 struct dss_module_power *stream_power = &parser->mp[DP_STREAM_PM]; in dp_parser_clock()
243 return -EINVAL; in dp_parser_clock()
246 core_clk_count = core_power->num_clk; in dp_parser_clock()
247 ctrl_clk_count = ctrl_power->num_clk; in dp_parser_clock()
248 stream_clk_count = stream_power->num_clk; in dp_parser_clock()
253 rc = of_property_read_string_index(dev->of_node, "clock-names", in dp_parser_clock()
256 DRM_ERROR("error reading clock-names %d\n", rc); in dp_parser_clock()
261 core_power->clocks[core_clk_index].id = devm_kstrdup(dev, clk_name, GFP_KERNEL); in dp_parser_clock()
265 stream_power->clocks[stream_clk_index].id = devm_kstrdup(dev, clk_name, GFP_KERNEL); in dp_parser_clock()
269 ctrl_power->clocks[ctrl_clk_index].id = devm_kstrdup(dev, clk_name, GFP_KERNEL); in dp_parser_clock()
279 struct platform_device *pdev = parser->pdev; in devm_dp_parser_find_next_bridge()
282 bridge = devm_drm_of_get_bridge(dev, pdev->dev.of_node, 1, 0); in devm_dp_parser_find_next_bridge()
286 parser->next_bridge = bridge; in devm_dp_parser_find_next_bridge()
297 return -EINVAL; in dp_parser_parse()
319 parser = devm_kzalloc(&pdev->dev, sizeof(*parser), GFP_KERNEL); in dp_parser_get()
321 return ERR_PTR(-ENOMEM); in dp_parser_get()
323 parser->parse = dp_parser_parse; in dp_parser_get()
324 parser->pdev = pdev; in dp_parser_get()