soc-integrator.c (734776eb16e8ca0e76b437b679059765321848ec) soc-integrator.c (be0db32f131b5641d3c8735bf47c24d37ab8d43c)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2014 Linaro Ltd.
4 *
5 * Author: Linus Walleij <linus.walleij@linaro.org>
6 */
7#include <linux/init.h>
8#include <linux/io.h>

--- 74 unchanged lines hidden (view full) ---

83static ssize_t
84build_show(struct device *dev, struct device_attribute *attr, char *buf)
85{
86 return sprintf(buf, "%02x\n", (integrator_coreid >> 4) & 0xFF);
87}
88
89static DEVICE_ATTR_RO(build);
90
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2014 Linaro Ltd.
4 *
5 * Author: Linus Walleij <linus.walleij@linaro.org>
6 */
7#include <linux/init.h>
8#include <linux/io.h>

--- 74 unchanged lines hidden (view full) ---

83static ssize_t
84build_show(struct device *dev, struct device_attribute *attr, char *buf)
85{
86 return sprintf(buf, "%02x\n", (integrator_coreid >> 4) & 0xFF);
87}
88
89static DEVICE_ATTR_RO(build);
90
91static struct attribute *integrator_attrs[] = {
92 &dev_attr_manufacturer.attr,
93 &dev_attr_arch.attr,
94 &dev_attr_fpga.attr,
95 &dev_attr_build.attr,
96 NULL
97};
98
99ATTRIBUTE_GROUPS(integrator);
100
91static int __init integrator_soc_init(void)
92{
93 static struct regmap *syscon_regmap;
94 struct soc_device *soc_dev;
95 struct soc_device_attribute *soc_dev_attr;
96 struct device_node *np;
97 struct device *dev;
98 u32 val;

--- 15 unchanged lines hidden (view full) ---

114
115 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
116 if (!soc_dev_attr)
117 return -ENOMEM;
118
119 soc_dev_attr->soc_id = "Integrator";
120 soc_dev_attr->machine = "Integrator";
121 soc_dev_attr->family = "Versatile";
101static int __init integrator_soc_init(void)
102{
103 static struct regmap *syscon_regmap;
104 struct soc_device *soc_dev;
105 struct soc_device_attribute *soc_dev_attr;
106 struct device_node *np;
107 struct device *dev;
108 u32 val;

--- 15 unchanged lines hidden (view full) ---

124
125 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
126 if (!soc_dev_attr)
127 return -ENOMEM;
128
129 soc_dev_attr->soc_id = "Integrator";
130 soc_dev_attr->machine = "Integrator";
131 soc_dev_attr->family = "Versatile";
132 soc_dev_attr->custom_attr_group = integrator_groups[0];
122 soc_dev = soc_device_register(soc_dev_attr);
123 if (IS_ERR(soc_dev)) {
124 kfree(soc_dev_attr);
125 return -ENODEV;
126 }
127 dev = soc_device_to_device(soc_dev);
128
133 soc_dev = soc_device_register(soc_dev_attr);
134 if (IS_ERR(soc_dev)) {
135 kfree(soc_dev_attr);
136 return -ENODEV;
137 }
138 dev = soc_device_to_device(soc_dev);
139
129 device_create_file(dev, &dev_attr_manufacturer);
130 device_create_file(dev, &dev_attr_arch);
131 device_create_file(dev, &dev_attr_fpga);
132 device_create_file(dev, &dev_attr_build);
133
134 dev_info(dev, "Detected ARM core module:\n");
135 dev_info(dev, " Manufacturer: %02x\n", (val >> 24));
136 dev_info(dev, " Architecture: %s\n", integrator_arch_str(val));
137 dev_info(dev, " FPGA: %s\n", integrator_fpga_str(val));
138 dev_info(dev, " Build: %02x\n", (val >> 4) & 0xFF);
139 dev_info(dev, " Rev: %c\n", ('A' + (val & 0x03)));
140
141 return 0;
142}
143device_initcall(integrator_soc_init);
140 dev_info(dev, "Detected ARM core module:\n");
141 dev_info(dev, " Manufacturer: %02x\n", (val >> 24));
142 dev_info(dev, " Architecture: %s\n", integrator_arch_str(val));
143 dev_info(dev, " FPGA: %s\n", integrator_fpga_str(val));
144 dev_info(dev, " Build: %02x\n", (val >> 4) & 0xFF);
145 dev_info(dev, " Rev: %c\n", ('A' + (val & 0x03)));
146
147 return 0;
148}
149device_initcall(integrator_soc_init);