Lines Matching +full:rs485 +full:- +full:rts +full:- +full:delay
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Technologic Systems TS-5500 Single Board Computer support
5 * Copyright (C) 2013-2014 Savoir-faire Linux Inc.
8 * This driver registers the Technologic Systems TS-5500 Single Board Computer
11 * Documentation/ABI/testing/sysfs-platform-ts5500.
13 * This code may be extended to support similar x86-based platforms.
14 * Actually, the TS-5500 and TS-5400 are supported.
17 #include <linux/delay.h>
28 #define TS5500_PRODUCT_CODE 0x60 /* TS-5500 product code */
29 #define TS5400_PRODUCT_CODE 0x40 /* TS-5400 product code */
31 /* SRAM/RS-485/ADC options, and RS-485 RTS/Automatic RS-485 flags register */
34 #define TS5500_RS485 BIT(1) /* RS-485 option */
36 #define TS5500_RS485_RTS BIT(6) /* RTS for RS-485 */
37 #define TS5500_RS485_AUTO BIT(7) /* Automatic RS-485 */
63 * struct ts5500_sbc - TS-5500 board description
67 * @rs485: Flag for RS-485 option.
77 bool rs485; member
89 { "TS-5x00 AMD Elan", 0xb14 },
95 int i, ret = -ENODEV; in ts5500_check_signature()
99 return -ENOMEM; in ts5500_check_signature()
120 return -EBUSY; in ts5500_detect_config()
122 sbc->id = inb(TS5500_PRODUCT_CODE_ADDR); in ts5500_detect_config()
123 if (sbc->id == TS5500_PRODUCT_CODE) { in ts5500_detect_config()
124 sbc->name = "TS-5500"; in ts5500_detect_config()
125 } else if (sbc->id == TS5400_PRODUCT_CODE) { in ts5500_detect_config()
126 sbc->name = "TS-5400"; in ts5500_detect_config()
128 pr_err("ts5500: unknown product code 0x%x\n", sbc->id); in ts5500_detect_config()
129 ret = -ENODEV; in ts5500_detect_config()
134 sbc->sram = tmp & TS5500_SRAM; in ts5500_detect_config()
135 sbc->rs485 = tmp & TS5500_RS485; in ts5500_detect_config()
136 sbc->adc = tmp & TS5500_ADC; in ts5500_detect_config()
139 sbc->ereset = tmp & TS5500_ERESET; in ts5500_detect_config()
140 sbc->itr = tmp & TS5500_ITR; in ts5500_detect_config()
143 sbc->jumpers = tmp & ~TS5500_LED; in ts5500_detect_config()
155 return sprintf(buf, "%s\n", sbc->name); in name_show()
164 return sprintf(buf, "0x%.2x\n", sbc->id); in id_show()
173 return sprintf(buf, "0x%.2x\n", sbc->jumpers >> 1); in jumpers_show()
183 return sprintf(buf, "%d\n", sbc->_field); \
188 TS5500_ATTR_BOOL(rs485);
214 .name = "ts5500-dio1",
215 .id = -1,
225 .name = "ts5500-dio2",
226 .id = -1,
258 * otherwise we have to re-initiate a conversion. in ts5500_adc_convert()
262 return -EBUSY; in ts5500_adc_convert()
277 .id = -1,
291 * only the BIOS provides a 16-bit identification call. in ts5500_init()
298 pdev = platform_device_register_simple("ts5500", -1, NULL, 0); in ts5500_init()
302 sbc = devm_kzalloc(&pdev->dev, sizeof(struct ts5500_sbc), GFP_KERNEL); in ts5500_init()
304 err = -ENOMEM; in ts5500_init()
314 err = sysfs_create_group(&pdev->dev.kobj, &ts5500_attr_group); in ts5500_init()
318 if (sbc->id == TS5500_PRODUCT_CODE) { in ts5500_init()
319 ts5500_dio1_pdev.dev.parent = &pdev->dev; in ts5500_init()
321 dev_warn(&pdev->dev, "DIO1 block registration failed\n"); in ts5500_init()
322 ts5500_dio2_pdev.dev.parent = &pdev->dev; in ts5500_init()
324 dev_warn(&pdev->dev, "DIO2 block registration failed\n"); in ts5500_init()
327 if (led_classdev_register(&pdev->dev, &ts5500_led_cdev)) in ts5500_init()
328 dev_warn(&pdev->dev, "LED registration failed\n"); in ts5500_init()
330 if (sbc->adc) { in ts5500_init()
331 ts5500_adc_pdev.dev.parent = &pdev->dev; in ts5500_init()
333 dev_warn(&pdev->dev, "ADC registration failed\n"); in ts5500_init()