| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/arch/arm/mach-omap2/id.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 8 | 9 | * |
|---|
| 9 | 10 | * Copyright (C) 2009-11 Texas Instruments |
|---|
| 10 | 11 | * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com> |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 13 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 14 | | - * published by the Free Software Foundation. |
|---|
| 15 | 12 | */ |
|---|
| 16 | 13 | |
|---|
| 17 | 14 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 399 | 396 | cpu_rev = "3.1"; |
|---|
| 400 | 397 | break; |
|---|
| 401 | 398 | case 7: |
|---|
| 402 | | - /* FALLTHROUGH */ |
|---|
| 403 | 399 | default: |
|---|
| 404 | 400 | /* Use the latest known revision as default */ |
|---|
| 405 | 401 | omap_revision = OMAP3430_REV_ES3_1_2; |
|---|
| .. | .. |
|---|
| 419 | 415 | cpu_rev = "1.0"; |
|---|
| 420 | 416 | break; |
|---|
| 421 | 417 | case 1: |
|---|
| 422 | | - /* FALLTHROUGH */ |
|---|
| 423 | 418 | default: |
|---|
| 424 | 419 | omap_revision = AM35XX_REV_ES1_1; |
|---|
| 425 | 420 | cpu_rev = "1.1"; |
|---|
| .. | .. |
|---|
| 438 | 433 | cpu_rev = "1.1"; |
|---|
| 439 | 434 | break; |
|---|
| 440 | 435 | case 2: |
|---|
| 441 | | - /* FALLTHROUGH */ |
|---|
| 442 | 436 | default: |
|---|
| 443 | 437 | omap_revision = OMAP3630_REV_ES1_2; |
|---|
| 444 | 438 | cpu_rev = "1.2"; |
|---|
| .. | .. |
|---|
| 459 | 453 | cpu_rev = "2.0"; |
|---|
| 460 | 454 | break; |
|---|
| 461 | 455 | case 3: |
|---|
| 462 | | - /* FALLTHROUGH */ |
|---|
| 463 | 456 | default: |
|---|
| 464 | 457 | omap_revision = TI8168_REV_ES2_1; |
|---|
| 465 | 458 | cpu_rev = "2.1"; |
|---|
| .. | .. |
|---|
| 476 | 469 | cpu_rev = "2.0"; |
|---|
| 477 | 470 | break; |
|---|
| 478 | 471 | case 2: |
|---|
| 479 | | - /* FALLTHROUGH */ |
|---|
| 480 | 472 | default: |
|---|
| 481 | 473 | omap_revision = AM335X_REV_ES2_1; |
|---|
| 482 | 474 | cpu_rev = "2.1"; |
|---|
| .. | .. |
|---|
| 494 | 486 | cpu_rev = "1.1"; |
|---|
| 495 | 487 | break; |
|---|
| 496 | 488 | case 2: |
|---|
| 497 | | - /* FALLTHROUGH */ |
|---|
| 498 | 489 | default: |
|---|
| 499 | 490 | omap_revision = AM437X_REV_ES1_2; |
|---|
| 500 | 491 | cpu_rev = "1.2"; |
|---|
| .. | .. |
|---|
| 505 | 496 | case 0xb968: |
|---|
| 506 | 497 | switch (rev) { |
|---|
| 507 | 498 | case 0: |
|---|
| 508 | | - /* FALLTHROUGH */ |
|---|
| 509 | 499 | case 1: |
|---|
| 510 | 500 | omap_revision = TI8148_REV_ES1_0; |
|---|
| 511 | 501 | cpu_rev = "1.0"; |
|---|
| .. | .. |
|---|
| 515 | 505 | cpu_rev = "2.0"; |
|---|
| 516 | 506 | break; |
|---|
| 517 | 507 | case 3: |
|---|
| 518 | | - /* FALLTHROUGH */ |
|---|
| 519 | 508 | default: |
|---|
| 520 | 509 | omap_revision = TI8148_REV_ES2_1; |
|---|
| 521 | 510 | cpu_rev = "2.1"; |
|---|
| .. | .. |
|---|
| 778 | 767 | return kasprintf(GFP_KERNEL, "Unknown"); |
|---|
| 779 | 768 | } |
|---|
| 780 | 769 | |
|---|
| 781 | | -static ssize_t omap_get_type(struct device *dev, |
|---|
| 782 | | - struct device_attribute *attr, |
|---|
| 783 | | - char *buf) |
|---|
| 770 | +static ssize_t |
|---|
| 771 | +type_show(struct device *dev, struct device_attribute *attr, char *buf) |
|---|
| 784 | 772 | { |
|---|
| 785 | 773 | return sprintf(buf, "%s\n", omap_types[omap_type()]); |
|---|
| 786 | 774 | } |
|---|
| 787 | 775 | |
|---|
| 788 | | -static struct device_attribute omap_soc_attr = |
|---|
| 789 | | - __ATTR(type, S_IRUGO, omap_get_type, NULL); |
|---|
| 776 | +static DEVICE_ATTR_RO(type); |
|---|
| 777 | + |
|---|
| 778 | +static struct attribute *omap_soc_attrs[] = { |
|---|
| 779 | + &dev_attr_type.attr, |
|---|
| 780 | + NULL |
|---|
| 781 | +}; |
|---|
| 782 | + |
|---|
| 783 | +ATTRIBUTE_GROUPS(omap_soc); |
|---|
| 790 | 784 | |
|---|
| 791 | 785 | void __init omap_soc_device_init(void) |
|---|
| 792 | 786 | { |
|---|
| 793 | | - struct device *parent; |
|---|
| 794 | 787 | struct soc_device *soc_dev; |
|---|
| 795 | 788 | struct soc_device_attribute *soc_dev_attr; |
|---|
| 796 | 789 | |
|---|
| .. | .. |
|---|
| 801 | 794 | soc_dev_attr->machine = soc_name; |
|---|
| 802 | 795 | soc_dev_attr->family = omap_get_family(); |
|---|
| 803 | 796 | soc_dev_attr->revision = soc_rev; |
|---|
| 797 | + soc_dev_attr->custom_attr_group = omap_soc_groups[0]; |
|---|
| 804 | 798 | |
|---|
| 805 | 799 | soc_dev = soc_device_register(soc_dev_attr); |
|---|
| 806 | 800 | if (IS_ERR(soc_dev)) { |
|---|
| 807 | 801 | kfree(soc_dev_attr); |
|---|
| 808 | 802 | return; |
|---|
| 809 | 803 | } |
|---|
| 810 | | - |
|---|
| 811 | | - parent = soc_device_to_device(soc_dev); |
|---|
| 812 | | - device_create_file(parent, &omap_soc_attr); |
|---|
| 813 | 804 | } |
|---|
| 814 | 805 | #endif /* CONFIG_SOC_BUS */ |
|---|