diff options
-rw-r--r-- | Documentation/ABI/testing/sysfs-platform-ts5500 | 7 | ||||
-rw-r--r-- | arch/x86/platform/ts5500/ts5500.c | 23 |
2 files changed, 25 insertions, 5 deletions
diff --git a/Documentation/ABI/testing/sysfs-platform-ts5500 b/Documentation/ABI/testing/sysfs-platform-ts5500 index c88375a537a1..e685957caa12 100644 --- a/Documentation/ABI/testing/sysfs-platform-ts5500 +++ b/Documentation/ABI/testing/sysfs-platform-ts5500 | |||
@@ -30,6 +30,13 @@ Description: | |||
30 | the corresponding bit is set. For instance, 0x0e means jumpers | 30 | the corresponding bit is set. For instance, 0x0e means jumpers |
31 | 2, 3 and 4 are set. | 31 | 2, 3 and 4 are set. |
32 | 32 | ||
33 | What: /sys/devices/platform/ts5500/name | ||
34 | Date: July 2014 | ||
35 | KernelVersion: 3.16 | ||
36 | Contact: "Savoir-faire Linux Inc." <kernel@savoirfairelinux.com> | ||
37 | Description: | ||
38 | Model name of the TS board, e.g. "TS-5500". | ||
39 | |||
33 | What: /sys/devices/platform/ts5500/rs485 | 40 | What: /sys/devices/platform/ts5500/rs485 |
34 | Date: January 2013 | 41 | Date: January 2013 |
35 | KernelVersion: 3.7 | 42 | KernelVersion: 3.7 |
diff --git a/arch/x86/platform/ts5500/ts5500.c b/arch/x86/platform/ts5500/ts5500.c index 1bbf17bdb0cf..4eb8eea07dab 100644 --- a/arch/x86/platform/ts5500/ts5500.c +++ b/arch/x86/platform/ts5500/ts5500.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Technologic Systems TS-5500 Single Board Computer support | 2 | * Technologic Systems TS-5500 Single Board Computer support |
3 | * | 3 | * |
4 | * Copyright (C) 2013 Savoir-faire Linux Inc. | 4 | * Copyright (C) 2013-2014 Savoir-faire Linux Inc. |
5 | * Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 5 | * Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it under | 7 | * This program is free software; you can redistribute it and/or modify it under |
@@ -66,6 +66,7 @@ | |||
66 | 66 | ||
67 | /** | 67 | /** |
68 | * struct ts5500_sbc - TS-5500 board description | 68 | * struct ts5500_sbc - TS-5500 board description |
69 | * @name: Board model name. | ||
69 | * @id: Board product ID. | 70 | * @id: Board product ID. |
70 | * @sram: Flag for SRAM option. | 71 | * @sram: Flag for SRAM option. |
71 | * @rs485: Flag for RS-485 option. | 72 | * @rs485: Flag for RS-485 option. |
@@ -75,6 +76,7 @@ | |||
75 | * @jumpers: Bitfield for jumpers' state. | 76 | * @jumpers: Bitfield for jumpers' state. |
76 | */ | 77 | */ |
77 | struct ts5500_sbc { | 78 | struct ts5500_sbc { |
79 | const char *name; | ||
78 | int id; | 80 | int id; |
79 | bool sram; | 81 | bool sram; |
80 | bool rs485; | 82 | bool rs485; |
@@ -122,13 +124,14 @@ static int __init ts5500_detect_config(struct ts5500_sbc *sbc) | |||
122 | if (!request_region(TS5500_PRODUCT_CODE_ADDR, 4, "ts5500")) | 124 | if (!request_region(TS5500_PRODUCT_CODE_ADDR, 4, "ts5500")) |
123 | return -EBUSY; | 125 | return -EBUSY; |
124 | 126 | ||
125 | tmp = inb(TS5500_PRODUCT_CODE_ADDR); | 127 | sbc->id = inb(TS5500_PRODUCT_CODE_ADDR); |
126 | if (tmp != TS5500_PRODUCT_CODE) { | 128 | if (sbc->id == TS5500_PRODUCT_CODE) { |
127 | pr_err("This platform is not a TS-5500 (found ID 0x%x)\n", tmp); | 129 | sbc->name = "TS-5500"; |
130 | } else { | ||
131 | pr_err("ts5500: unknown product code 0x%x\n", sbc->id); | ||
128 | ret = -ENODEV; | 132 | ret = -ENODEV; |
129 | goto cleanup; | 133 | goto cleanup; |
130 | } | 134 | } |
131 | sbc->id = tmp; | ||
132 | 135 | ||
133 | tmp = inb(TS5500_SRAM_RS485_ADC_ADDR); | 136 | tmp = inb(TS5500_SRAM_RS485_ADC_ADDR); |
134 | sbc->sram = tmp & TS5500_SRAM; | 137 | sbc->sram = tmp & TS5500_SRAM; |
@@ -147,6 +150,15 @@ cleanup: | |||
147 | return ret; | 150 | return ret; |
148 | } | 151 | } |
149 | 152 | ||
153 | static ssize_t name_show(struct device *dev, struct device_attribute *attr, | ||
154 | char *buf) | ||
155 | { | ||
156 | struct ts5500_sbc *sbc = dev_get_drvdata(dev); | ||
157 | |||
158 | return sprintf(buf, "%s\n", sbc->name); | ||
159 | } | ||
160 | static DEVICE_ATTR_RO(name); | ||
161 | |||
150 | static ssize_t id_show(struct device *dev, struct device_attribute *attr, | 162 | static ssize_t id_show(struct device *dev, struct device_attribute *attr, |
151 | char *buf) | 163 | char *buf) |
152 | { | 164 | { |
@@ -183,6 +195,7 @@ TS5500_ATTR_BOOL(itr); | |||
183 | 195 | ||
184 | static struct attribute *ts5500_attributes[] = { | 196 | static struct attribute *ts5500_attributes[] = { |
185 | &dev_attr_id.attr, | 197 | &dev_attr_id.attr, |
198 | &dev_attr_name.attr, | ||
186 | &dev_attr_jumpers.attr, | 199 | &dev_attr_jumpers.attr, |
187 | &dev_attr_sram.attr, | 200 | &dev_attr_sram.attr, |
188 | &dev_attr_rs485.attr, | 201 | &dev_attr_rs485.attr, |