Received: by 10.223.185.116 with SMTP id b49csp6388279wrg; Wed, 28 Feb 2018 08:35:48 -0800 (PST) X-Google-Smtp-Source: AH8x226F5i8p6nsfmqd/3+kRheXQRsXFu2VNRNFUyVPicVfLsP7+GgDrRR1C4RcNLfBX5+wv/E0N X-Received: by 10.98.201.194 with SMTP id l63mr18221224pfk.126.1519835748855; Wed, 28 Feb 2018 08:35:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519835748; cv=none; d=google.com; s=arc-20160816; b=sN2bNoA1cSdHPq/CF7Hw8sA8QAZ96zLjkDZi6mVRTzjUHqevFEkIl9lt3egM1uLNbd ZYTvyjYBj7j0J5zDSABwxi4ApjRmA9+l6fjE3UF/GlNKdlMonoEG+/vTjedKGxcyxNv0 qaYP8X8aUoytzkjoBG60SMB3S1KMNwwavP1o/JTaPDnceVTED4Ziouj6gIa9YcX9hnld j5zMegJwaeGc5f9BDXy0zhkcdNL4co6rkDE4O9qPUZxhtpsKSJV5lCtK89UPLLylP2dm ReJNSDLoVY7AGLUuyGASfbcauNnVYFUZOx1qoBdFtZcLGYtxbSYVeJpo/YxsPp7qO6Np T3JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=pGSSGyQTVv13qrqe4Aw316vw02T1Qn4BxujdAY4T8oc=; b=DcV6Oczc9obA5GGLuaYJDUUe92Y1UT0LrKpw9lTNuUxBglaiO5fxZ4AxCMss9I7RmH u7vYTKAnIzy4HP7SMpBilDOg/OOrTaYWwnVsG7ZXQWBYY9iQIJivDXPVT+GWO7yr+NWK zJP7wRxk4rPM8I9Vrscuq/GDN2jEbEPWn7iXmlxgylJA63xATry9Rt1xd9mE5sUo2Ahk 4LIMoOfkSqoGDJkd3sof96qpNG57hjvTm64cPJJBgaiG1xDruLkeGvyk/wqXUQIpwHYQ SO/puDdl0WpTVmGu+JQUpnvDu5DQvvv+2MR/hPzw5h817v7a+A7htDNjwIiFJFnc2RdC lisg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gateworks-com.20150623.gappssmtp.com header.s=20150623 header.b=KoiS6D8L; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u5si1211299pgv.424.2018.02.28.08.35.31; Wed, 28 Feb 2018 08:35:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gateworks-com.20150623.gappssmtp.com header.s=20150623 header.b=KoiS6D8L; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934715AbeB1Qez (ORCPT + 99 others); Wed, 28 Feb 2018 11:34:55 -0500 Received: from mail-wr0-f176.google.com ([209.85.128.176]:34646 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932358AbeB1Qev (ORCPT ); Wed, 28 Feb 2018 11:34:51 -0500 Received: by mail-wr0-f176.google.com with SMTP id m5so3092808wrg.1 for ; Wed, 28 Feb 2018 08:34:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gateworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pGSSGyQTVv13qrqe4Aw316vw02T1Qn4BxujdAY4T8oc=; b=KoiS6D8LcL+IojsEExjvsHj7QWRjYn1V3STR8JA9YatkfKU8sCY0Ssh8YyQRefryvV EtI9zbyzY41O7sLsfw8WHrDFvA64RiId9rSJBKi2gxs7jvGj+KB/8GqJs73kks3nOECR bDkLzrQDp0iQXYfCE6sRezrB0Acj6V0oehJqoE0E8bOUDc6YPRm2tvHu5Tlzt55erYg6 s+nNracj3gc5QtNj+nLxvczvUT1BeOGy1Hi9aoAJ5w1RRzWtKebWQDkOE8/ywUm9lO4Q 93557xaOxifPkl2R26/UVPiNDJYGd9v9/e/VrLSUDOny56dpaXv2XrZWlr3MDqhLezlF Cwow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pGSSGyQTVv13qrqe4Aw316vw02T1Qn4BxujdAY4T8oc=; b=HUmeQ9IItqISLEUHaLK1p109fbWD7Bi7whpIdTOAp4AnYdpDC5u9cRS/Pl3g8tJurP GR+jnjrso56Fox0YqH0zjbMx++438MEd612LGWRHTv1Z2YzJrxfCKUDCIuAotW6SPh9E +MGSmmNuvniam6g0E7mGJncdNKi97d4iAaj3EELTC2NEH8LPa8WgNZuVo5c9znzJIrT2 O6zmGJuQ3icfyNzZdkbqF6ayy1r20eo0iVKEslXGuypkiE59QOkecHSCWMXNTyEAF8C6 tMP95XHtu24n0U66myM83DWSxae+waKEXmRRloS1lsn0IUQprCr0ZmlJa0TTI4a6IVgL 6n1w== X-Gm-Message-State: APf1xPDAqHJv5VHVQ9IjAw/uXSbU0YLivH9vFm06LQjQedVAmjrXrjXW 6c+Vpub4Lv/uwyZpPmd6gQriS0MOBfylvzfPmevU+Q== X-Received: by 10.223.183.39 with SMTP id l39mr17901719wre.214.1519835689977; Wed, 28 Feb 2018 08:34:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.6.66 with HTTP; Wed, 28 Feb 2018 08:34:49 -0800 (PST) In-Reply-To: <20180228144424.GC12303@lunn.ch> References: <1519780874-8558-1-git-send-email-tharvey@gateworks.com> <20180228144424.GC12303@lunn.ch> From: Tim Harvey Date: Wed, 28 Feb 2018 08:34:49 -0800 Message-ID: Subject: Re: [RFC 0/4] Add support for the Gateworks System Controller To: Andrew Lunn Cc: Lee Jones , Rob Herring , Mark Rutland , Mark Brown , Dmitry Torokhov , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 28, 2018 at 6:44 AM, Andrew Lunn wrote: > On Tue, Feb 27, 2018 at 05:21:10PM -0800, Tim Harvey wrote: >> This series adds support for the Gateworks System Controller used on Gateworks >> Laguna, Ventana, and Newport product families. >> >> The GSC is an MSP430 I2C slave controller whose firmware embeds the following >> features: >> - I/O expander (16 GPIO's emulating a PCA955x) >> - EEPROM (enumating AT24) >> - RTC (enumating DS1672) > > Hi Tim > > Maybe it is in these patches, and i missed it.... > > How do these emulated devices work? Does the controller respond to > different addresses for these different emulated devices? Or is it an > I2c bus mux? > Andrew, You didn't miss it - I probably need to explain it better. The 'emulated devices' do respond on different slave addresses (which match one of or the only the slave addresses those parts support). For example the device-tree for the GW54xx has the following which are all from the GSC which is the only thing on i2c1: &i2c1 { clock-frequency = <100000>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c1>; status = "okay"; gsc: gsc@20 { compatible = "gw,gsc_v2"; reg = <0x20>; interrupt-parent = <&gpio1>; interrupts = <4 GPIO_ACTIVE_LOW>; interrupt-controller; #interrupt-cells = <1>; gsc_input { compatible = "gw,gsc-input"; }; gsc_hwmon { compatible = "gw,gsc-hwmon"; #address-cells = <1>; #size-cells = <0>; hwmon@0 { /* A0: Board Temperature */ type = <0>; reg = <0x00>; label = "temp"; /* lookup table */ }; hwmon@1 { /* A1: Input Voltage */ type = <1>; reg = <0x02>; label = "Vin"; gw,voltage-divider = <22100 1000>; gw,offset = <800>; }; hwmon@2 { /* A2: 5P0 */ type = <1>; reg = <0x0b>; label = "5P0"; gw,voltage-divider = <22100 1000>; }; hwmon@4 { /* A4: 0-5V input */ type = <1>; reg = <0x14>; label = "ANL0"; gw,voltage-divider = <10000 10000>; }; hwmon@5 { /* A5: 2P5 PCIe/GigE */ type = <1>; reg = <0x23>; label = "2P5"; gw,voltage-divider = <10000 10000>; }; hwmon@6 { /* A6: 1P8 Aud/Vid */ type = <1>; reg = <0x1d>; label = "1P8"; }; hwmon@7 { /* A7: GPS */ type = <1>; reg = <0x26>; label = "GPS"; gw,voltage-divider = <4990 10000>; }; hwmon@12 { /* A12: VDD_CORE */ type = <1>; reg = <0x3>; label = "VDD_CORE"; }; hwmon@13 { /* A13: VDD_SOC */ type = <1>; reg = <0x11>; label = "VDD_SOC"; }; hwmon@14 { /* A14: 1P0 PCIe SW */ type = <1>; reg = <0x20>; label = "1P0"; }; hwmon@15 { /* fan0 */ type = <2>; reg = <0x2c>; label = "fan_50p"; }; hwmon@16 { /* fan1 */ type = <2>; reg = <0x2e>; label = "fan_60p"; }; hwmon@17 { /* fan2 */ type = <2>; reg = <0x30>; label = "fan_70p"; }; hwmon@18 { /* fan3 */ type = <2>; reg = <0x32>; label = "fan_80p"; }; hwmon@19 { /* fan4 */ type = <2>; reg = <0x34>; label = "fan_90p"; }; hwmon@20 { /* fan5 */ type = <2>; reg = <0x36>; label = "fan_100p"; }; }; }; gsc_gpio: pca9555@23 { compatible = "nxp,pca9555"; reg = <0x23>; gpio-controller; #gpio-cells = <2>; interrupt-parent = <&gsc>; interrupts = <4>; }; eeprom1: eeprom@50 { compatible = "atmel,24c02"; reg = <0x50>; pagesize = <16>; }; eeprom2: eeprom@51 { compatible = "atmel,24c02"; reg = <0x51>; pagesize = <16>; }; eeprom3: eeprom@52 { compatible = "atmel,24c02"; reg = <0x52>; pagesize = <16>; }; eeprom4: eeprom@53 { compatible = "atmel,24c02"; reg = <0x53>; pagesize = <16>; }; rtc: ds1672@68 { compatible = "dallas,ds1672"; reg = <0x68>; }; }; One issue I'm trying to figure out the best way to deal with is the fact that the GSC can 'NAK' transactions occasionally which is why I override the regmap read/write functions and provide retries. This resolves the issue for the mfd core driver and sub-module drivers but doesn't resolve the issue with these 'emulated devices' which have their own stand-alone drivers. I'm not sure how to best deal with that yet. I tried to add retires to the i2c adapter but that wasn't accepted upstream because it was too generic and I was told I need to work around it in device-drivers. I'm guessing I need to write my own sub-module drivers that will largely duplicate whats in the stand-alone drivers (ds1672, at24, pca9553x). Regards, Tim