aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/platform/ts5500
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2014-07-08 18:57:48 -0400
committerIngo Molnar <mingo@kernel.org>2014-07-16 15:17:41 -0400
commit84e288d41871cfb7a21cb7e6dee9e3884b59b25f (patch)
treeda24a6c2eb5200f465f0151ad76b9b48bd9e35e6 /arch/x86/platform/ts5500
parent1d2408754d2c1376d67c00852548758e1ec2a94c (diff)
x86/platform/ts5500: Add a 'name' sysfs attribute
Add a new "name" attribute to the TS5500 sysfs group, to clarify which supported board model it is. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Cc: Savoir-faire Linux Inc. <kernel@savoirfairelinux.com> Link: http://lkml.kernel.org/r/1404860269-11837-3-git-send-email-vivien.didelot@savoirfairelinux.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/platform/ts5500')
-rw-r--r--arch/x86/platform/ts5500/ts5500.c23
1 files changed, 18 insertions, 5 deletions
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 */
77struct ts5500_sbc { 78struct 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
153static 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}
160static DEVICE_ATTR_RO(name);
161
150static ssize_t id_show(struct device *dev, struct device_attribute *attr, 162static 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
184static struct attribute *ts5500_attributes[] = { 196static 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,