| .. | .. |
|---|
| 73 | 73 | struct device_node *np = dev->of_node; |
|---|
| 74 | 74 | struct device_node *child; |
|---|
| 75 | 75 | unsigned int enable_msk, bus_id, cfg; |
|---|
| 76 | | - int ret; |
|---|
| 76 | + char *prp_name = "rockchip,soc-bus-table"; |
|---|
| 77 | + u32 *table = NULL; |
|---|
| 78 | + int ret = 0, config_cnt, i; |
|---|
| 77 | 79 | |
|---|
| 78 | 80 | for_each_available_child_of_node(np, child) { |
|---|
| 79 | 81 | ret = of_property_read_u32_index(child, "bus-id", 0, |
|---|
| .. | .. |
|---|
| 108 | 110 | } |
|---|
| 109 | 111 | } |
|---|
| 110 | 112 | |
|---|
| 111 | | - return 0; |
|---|
| 113 | + config_cnt = of_property_count_u32_elems(np, prp_name); |
|---|
| 114 | + if (config_cnt <= 0) { |
|---|
| 115 | + return 0; |
|---|
| 116 | + } else if (config_cnt % 3) { |
|---|
| 117 | + dev_err(dev, "Invalid count of %s\n", prp_name); |
|---|
| 118 | + return -EINVAL; |
|---|
| 119 | + } |
|---|
| 120 | + |
|---|
| 121 | + table = kmalloc_array(config_cnt, sizeof(u32), GFP_KERNEL); |
|---|
| 122 | + if (!table) |
|---|
| 123 | + return -ENOMEM; |
|---|
| 124 | + |
|---|
| 125 | + ret = of_property_read_u32_array(np, prp_name, table, config_cnt); |
|---|
| 126 | + if (ret) { |
|---|
| 127 | + dev_err(dev, "get %s error\n", prp_name); |
|---|
| 128 | + goto free_table; |
|---|
| 129 | + } |
|---|
| 130 | + |
|---|
| 131 | + /* table[3n]: bus_id |
|---|
| 132 | + * table[3n + 1]: config |
|---|
| 133 | + * table[3n + 2]: enable_mask |
|---|
| 134 | + */ |
|---|
| 135 | + for (i = 0; i < config_cnt; i += 3) { |
|---|
| 136 | + bus_id = table[i]; |
|---|
| 137 | + cfg = table[i + 1]; |
|---|
| 138 | + enable_msk = table[i + 2]; |
|---|
| 139 | + |
|---|
| 140 | + if (!cfg) { |
|---|
| 141 | + dev_info(dev, "cfg-val invalid in %s-%d\n", prp_name, bus_id); |
|---|
| 142 | + continue; |
|---|
| 143 | + } |
|---|
| 144 | + |
|---|
| 145 | + ret = rockchip_sip_bus_smc_config(bus_id, cfg, enable_msk); |
|---|
| 146 | + if (ret) { |
|---|
| 147 | + dev_err(dev, "bus smc config error: %x!\n", ret); |
|---|
| 148 | + goto free_table; |
|---|
| 149 | + } |
|---|
| 150 | + } |
|---|
| 151 | + |
|---|
| 152 | +free_table: |
|---|
| 153 | + kfree(table); |
|---|
| 154 | + |
|---|
| 155 | + return ret; |
|---|
| 112 | 156 | } |
|---|
| 113 | 157 | |
|---|
| 114 | 158 | static int rockchip_bus_set_freq_table(struct rockchip_bus *bus) |
|---|
| .. | .. |
|---|
| 348 | 392 | { |
|---|
| 349 | 393 | struct rockchip_bus *bus = to_rockchip_bus_cpufreq_nb(nb); |
|---|
| 350 | 394 | struct cpufreq_freqs *freqs = data; |
|---|
| 351 | | - int id = topology_physical_package_id(freqs->cpu); |
|---|
| 395 | + int id = topology_physical_package_id(freqs->policy->cpu); |
|---|
| 352 | 396 | |
|---|
| 353 | 397 | if (id < 0 || id >= MAX_CLUSTERS) |
|---|
| 354 | 398 | return NOTIFY_DONE; |
|---|
| .. | .. |
|---|
| 364 | 408 | bus->cpu_freq[CLUSTER1] > bus->cpu_high_freq) && |
|---|
| 365 | 409 | bus->cur_rate != bus->high_rate) { |
|---|
| 366 | 410 | dev_dbg(bus->dev, "cpu%d freq=%d %d, up cci rate to %lu\n", |
|---|
| 367 | | - freqs->cpu, |
|---|
| 411 | + freqs->policy->cpu, |
|---|
| 368 | 412 | bus->cpu_freq[CLUSTER0], |
|---|
| 369 | 413 | bus->cpu_freq[CLUSTER1], |
|---|
| 370 | 414 | bus->high_rate); |
|---|
| .. | .. |
|---|
| 377 | 421 | bus->cpu_freq[CLUSTER1] <= bus->cpu_high_freq && |
|---|
| 378 | 422 | bus->cur_rate != bus->low_rate) { |
|---|
| 379 | 423 | dev_dbg(bus->dev, "cpu%d freq=%d %d, down cci rate to %lu\n", |
|---|
| 380 | | - freqs->cpu, |
|---|
| 424 | + freqs->policy->cpu, |
|---|
| 381 | 425 | bus->cpu_freq[CLUSTER0], |
|---|
| 382 | 426 | bus->cpu_freq[CLUSTER1], |
|---|
| 383 | 427 | bus->low_rate); |
|---|
| .. | .. |
|---|
| 447 | 491 | { .compatible = "rockchip,rk3288-bus", }, |
|---|
| 448 | 492 | { .compatible = "rockchip,rk3368-bus", }, |
|---|
| 449 | 493 | { .compatible = "rockchip,rk3399-bus", }, |
|---|
| 494 | + { .compatible = "rockchip,rk3528-bus", }, |
|---|
| 495 | + { .compatible = "rockchip,rk3562-bus", }, |
|---|
| 450 | 496 | { .compatible = "rockchip,rk3568-bus", }, |
|---|
| 497 | + { .compatible = "rockchip,rk3588-bus", }, |
|---|
| 451 | 498 | { .compatible = "rockchip,rv1126-bus", }, |
|---|
| 452 | 499 | { }, |
|---|
| 453 | 500 | }; |
|---|