kumquat-buildroot/board/ts/ts5x00/patches/linux/linux-001-add-support-for-ts5400.patch
Vivien Didelot 483e3bef47 configs: add defconfig for TS-5x00 SBCs
This patch adds support for the TS-5x00 serie of Technologic Systems
x86-based Single Board Computers, featuring an AMD Elan520 processor.

http://wiki.embeddedarm.com/wiki/#AMD

[Peter: explicitly set arch/variant in defconfig, strip trailing spaces]
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-07-08 14:04:34 +02:00

118 lines
3.6 KiB
Diff

From 510acd057785ff52bfdfed6360a44a42f44e078f Mon Sep 17 00:00:00 2001
From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Date: Mon, 7 Jul 2014 15:56:11 -0400
Subject: [PATCH] x86: (ts5500) add board support for TS-5400
This patch extends the TS-5500 board support to identify the compatible
TS-5400 Single Board Computer (ID 0x40).
It also adds a new "name" sysfs attribute for more human readable
identification, actually printing "TS-5500" or "TS-5400".
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
arch/x86/platform/ts5500/ts5500.c | 34 +++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/arch/x86/platform/ts5500/ts5500.c b/arch/x86/platform/ts5500/ts5500.c
index 9471b94..127fce2 100644
--- a/arch/x86/platform/ts5500/ts5500.c
+++ b/arch/x86/platform/ts5500/ts5500.c
@@ -31,7 +31,6 @@
/* Product code register */
#define TS5500_PRODUCT_CODE_ADDR 0x74
-#define TS5500_PRODUCT_CODE 0x60 /* TS-5500 product code */
/* SRAM/RS-485/ADC options, and RS-485 RTS/Automatic RS-485 flags register */
#define TS5500_SRAM_RS485_ADC_ADDR 0x75
@@ -64,9 +63,17 @@
#define TS5500_ADC_CONV_MSB_ADDR 0x197 /* MSB register */
#define TS5500_ADC_CONV_DELAY 12 /* usec */
+static const struct ts5x00_info {
+ const int id;
+ const char * const name;
+} ts5x00_info[] = {
+ { 0x40, "TS-5400" },
+ { 0x60, "TS-5500" },
+};
+
/**
* struct ts5500_sbc - TS-5500 board description
- * @id: Board product ID.
+ * @info: Board identification.
* @sram: Flag for SRAM option.
* @rs485: Flag for RS-485 option.
* @adc: Flag for Analog/Digital converter option.
@@ -75,7 +82,7 @@
* @jumpers: Bitfield for jumpers' state.
*/
struct ts5500_sbc {
- int id;
+ const struct ts5x00_info *info;
bool sram;
bool rs485;
bool adc;
@@ -117,18 +124,21 @@ static int __init ts5500_check_signature(void)
static int __init ts5500_detect_config(struct ts5500_sbc *sbc)
{
u8 tmp;
+ int i;
int ret = 0;
if (!request_region(TS5500_PRODUCT_CODE_ADDR, 4, "ts5500"))
return -EBUSY;
tmp = inb(TS5500_PRODUCT_CODE_ADDR);
- if (tmp != TS5500_PRODUCT_CODE) {
- pr_err("This platform is not a TS-5500 (found ID 0x%x)\n", tmp);
+ for (i = 0; i < ARRAY_SIZE(ts5x00_info) && !sbc->info; ++i)
+ if (tmp == ts5x00_info[i].id)
+ sbc->info = &ts5x00_info[i];
+ if (!sbc->info) {
+ pr_err("Not a known TS-5x00 platform (found ID 0x%x)\n", tmp);
ret = -ENODEV;
goto cleanup;
}
- sbc->id = tmp;
tmp = inb(TS5500_SRAM_RS485_ADC_ADDR);
sbc->sram = tmp & TS5500_SRAM;
@@ -152,7 +162,15 @@ static ssize_t ts5500_show_id(struct device *dev,
{
struct ts5500_sbc *sbc = dev_get_drvdata(dev);
- return sprintf(buf, "0x%.2x\n", sbc->id);
+ return sprintf(buf, "0x%.2x\n", sbc->info->id);
+}
+
+static ssize_t ts5500_show_name(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct ts5500_sbc *sbc = dev_get_drvdata(dev);
+
+ return sprintf(buf, "%s\n", sbc->info->name);
}
static ssize_t ts5500_show_jumpers(struct device *dev,
@@ -180,6 +198,7 @@ TS5500_SHOW(ereset)
TS5500_SHOW(itr)
static DEVICE_ATTR(id, S_IRUGO, ts5500_show_id, NULL);
+static DEVICE_ATTR(name, S_IRUGO, ts5500_show_name, NULL);
static DEVICE_ATTR(jumpers, S_IRUGO, ts5500_show_jumpers, NULL);
static DEVICE_ATTR(sram, S_IRUGO, ts5500_show_sram, NULL);
static DEVICE_ATTR(rs485, S_IRUGO, ts5500_show_rs485, NULL);
@@ -189,6 +208,7 @@ static DEVICE_ATTR(itr, S_IRUGO, ts5500_show_itr, NULL);
static struct attribute *ts5500_attributes[] = {
&dev_attr_id.attr,
+ &dev_attr_name.attr,
&dev_attr_jumpers.attr,
&dev_attr_sram.attr,
&dev_attr_rs485.attr,
--
1.9.1