| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Freescale QorIQ Platforms GUTS Driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2016 Freescale Semiconductor, Inc. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | |
|---|
| 12 | 8 | #include <linux/io.h> |
|---|
| .. | .. |
|---|
| 100 | 96 | .svr = 0x87000000, |
|---|
| 101 | 97 | .mask = 0xfff70000, |
|---|
| 102 | 98 | }, |
|---|
| 99 | + /* Die: LX2160A, SoC: LX2160A/LX2120A/LX2080A */ |
|---|
| 100 | + { .die = "LX2160A", |
|---|
| 101 | + .svr = 0x87360000, |
|---|
| 102 | + .mask = 0xff3f0000, |
|---|
| 103 | + }, |
|---|
| 104 | + /* Die: LS1028A, SoC: LS1028A */ |
|---|
| 105 | + { .die = "LS1028A", |
|---|
| 106 | + .svr = 0x870b0000, |
|---|
| 107 | + .mask = 0xff3f0000, |
|---|
| 108 | + }, |
|---|
| 103 | 109 | { }, |
|---|
| 104 | 110 | }; |
|---|
| 105 | 111 | |
|---|
| .. | .. |
|---|
| 114 | 120 | return NULL; |
|---|
| 115 | 121 | } |
|---|
| 116 | 122 | |
|---|
| 117 | | -u32 fsl_guts_get_svr(void) |
|---|
| 123 | +static u32 fsl_guts_get_svr(void) |
|---|
| 118 | 124 | { |
|---|
| 119 | 125 | u32 svr = 0; |
|---|
| 120 | 126 | |
|---|
| .. | .. |
|---|
| 128 | 134 | |
|---|
| 129 | 135 | return svr; |
|---|
| 130 | 136 | } |
|---|
| 131 | | -EXPORT_SYMBOL(fsl_guts_get_svr); |
|---|
| 132 | 137 | |
|---|
| 133 | 138 | static int fsl_guts_probe(struct platform_device *pdev) |
|---|
| 134 | 139 | { |
|---|
| .. | .. |
|---|
| 136 | 141 | struct device *dev = &pdev->dev; |
|---|
| 137 | 142 | struct resource *res; |
|---|
| 138 | 143 | const struct fsl_soc_die_attr *soc_die; |
|---|
| 139 | | - const char *machine; |
|---|
| 144 | + const char *machine = NULL; |
|---|
| 140 | 145 | u32 svr; |
|---|
| 141 | 146 | |
|---|
| 142 | 147 | /* Initialize guts */ |
|---|
| .. | .. |
|---|
| 155 | 160 | root = of_find_node_by_path("/"); |
|---|
| 156 | 161 | if (of_property_read_string(root, "model", &machine)) |
|---|
| 157 | 162 | of_property_read_string_index(root, "compatible", 0, &machine); |
|---|
| 158 | | - of_node_put(root); |
|---|
| 159 | | - if (machine) |
|---|
| 163 | + if (machine) { |
|---|
| 160 | 164 | soc_dev_attr.machine = devm_kstrdup(dev, machine, GFP_KERNEL); |
|---|
| 165 | + if (!soc_dev_attr.machine) { |
|---|
| 166 | + of_node_put(root); |
|---|
| 167 | + return -ENOMEM; |
|---|
| 168 | + } |
|---|
| 169 | + } |
|---|
| 170 | + of_node_put(root); |
|---|
| 161 | 171 | |
|---|
| 162 | 172 | svr = fsl_guts_get_svr(); |
|---|
| 163 | 173 | soc_die = fsl_soc_die_match(svr, fsl_soc_die); |
|---|
| .. | .. |
|---|
| 222 | 232 | { .compatible = "fsl,ls1088a-dcfg", }, |
|---|
| 223 | 233 | { .compatible = "fsl,ls1012a-dcfg", }, |
|---|
| 224 | 234 | { .compatible = "fsl,ls1046a-dcfg", }, |
|---|
| 235 | + { .compatible = "fsl,lx2160a-dcfg", }, |
|---|
| 236 | + { .compatible = "fsl,ls1028a-dcfg", }, |
|---|
| 225 | 237 | {} |
|---|
| 226 | 238 | }; |
|---|
| 227 | 239 | MODULE_DEVICE_TABLE(of, fsl_guts_of_match); |
|---|