From owner-svn-src-head@freebsd.org Thu Nov 5 22:43:31 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 862C0A26D37; Thu, 5 Nov 2015 22:43:31 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from smtp.breitband.ch (smtp.breitband.ch [157.161.12.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D05A1BDE; Thu, 5 Nov 2015 22:43:30 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from [192.168.225.14] (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by fgznet.ch (Postfix) with ESMTPS id AE1BAD88D6; Thu, 5 Nov 2015 23:43:27 +0100 (CET) Subject: Re: svn commit: r290373 - head/sys/dev/ofw To: Nathan Whitehorn , Warner Losh , Ian Lepore References: <201511042246.tA4MkUYU010551@repo.freebsd.org> <563BB466.8020801@freebsd.org> <563BC911.5060804@FreeBSD.org> <563BCE7C.9020900@freebsd.org> Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Andreas Tobler Message-ID: <563BDB8F.8090504@FreeBSD.org> Date: Thu, 5 Nov 2015 23:43:27 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <563BCE7C.9020900@freebsd.org> Content-Type: multipart/mixed; boundary="------------010507070301090902050103" X-Scanned-By: MIMEDefang 2.73 on 127.0.1.1 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2015 22:43:31 -0000 This is a multi-part message in MIME format. --------------010507070301090902050103 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 05.11.15 22:47, Nathan Whitehorn wrote: > On 11/05/15 13:24, Andreas Tobler wrote: >> Hi Nathan, Warner, >> >> first, I had the feeling that I have to provide a fast solution which >> makes PowerMacs usable again. I am aware that the committed version >> doesn't win a prize. > > Thank you! > >> Also, I didn't know that we have AIM & FDT, Nathan which one? > > PS3 and POWER8 systems are AIM+FDT. Neither of these have I2C busses in > their FDTs, so the impact is low for now, but it makes me a little nervous. Ah, maybe I have luck to convince my son to handover the PS3 to me. He has a PS4 too... About the POWER8, well, far away from my budget..... >> On 05.11.15 21:26, Warner Losh wrote: >>> I'd suggested that this be driven off a global quirk like >>> >>> u_int fdt_quirks; >>> #define FDT_QUIRK_8BIT_IIC_ADDR 1 >>> ... >> >> In openfirm.h? > > I'd really prefer an explicit platform check in ofw_iicbus.c for this by > looking at the compatible property of the root node. If this ever comes > up on another system, we can modify it, but I think it won't. Attached a working proposal. It does work with the Apple 8-bit I2C addresses and the fan regulation works. But I need a kind soul to test this on an arm board with Linux based FDT I2C devices which have 7-bit addresses. Ian? Thanks in advance, Andreas >>> if (fdt_quirks & FDT_QUIRK_8BIT_IIC_ADDR) >>> dinfo->opd_dinfo.addr = paddr; >>> else >>> dinfo->opd_dinfo.addr = paddr << 1; >>> >>> And the platform code, whatever that means, would set it when it "knows" >>> this is the case. >> >> If I get that right, I'd have to set the fdt_quirk in each I2C parent, >> like kiic.c and smu.c? >> >>> On Thu, Nov 5, 2015 at 12:56 PM, Nathan Whitehorn >>> > wrote: >>> >>> I'm not sure this is the best way to do this: we have AIM systems >>> that use FDT, for example. Can we make it a quirk in the host-bus >>> driver? Or do a run-time check to see if the root node has MacRISC >>> in its compatible property? >> >> The 'compatible property' approach would be limited/isolated to one >> file (ofw_iicbus.c) in comparison to the quirk approach where I'd have >> to adapt at least (known now) four files. >> >> I can go either way, just my thoughts. --------------010507070301090902050103 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="ofw_iicbus.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="ofw_iicbus.diff" SW5kZXg6IHN5cy9kZXYvb2Z3L29md19paWNidXMuYwo9PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBzeXMv ZGV2L29mdy9vZndfaWljYnVzLmMJKHJldmlzaW9uIDI5MDM3MykKKysrIHN5cy9kZXYvb2Z3 L29md19paWNidXMuYwkod29ya2luZyBjb3B5KQpAQCAtMTAxLDkgKzEwMSwxMyBAQAogewog CXN0cnVjdCBpaWNidXNfc29mdGMgKnNjID0gSUlDQlVTX1NPRlRDKGRldik7CiAJc3RydWN0 IG9md19paWNidXNfZGV2aW5mbyAqZGluZm87Ci0JcGhhbmRsZV90IGNoaWxkLCBub2RlOwor CXBoYW5kbGVfdCBjaGlsZCwgbm9kZSwgcm9vdDsKIAlwY2VsbF90IGZyZXEsIHBhZGRyOwog CWRldmljZV90IGNoaWxkZGV2OworCXNzaXplX3QgY29tcGF0bGVuOworCWNoYXIgY29tcGF0 WzI1NV07CisJY2hhciAqY3Vyc3RyOworCXVfaW50IGlpY19hZGRyXzhiaXQgPSAwOwogCiAJ c2MtPmRldiA9IGRldjsKIAltdHhfaW5pdCgmc2MtPmxvY2ssICJpaWNidXMiLCBOVUxMLCBN VFhfREVGKTsKQEAgLTEyNSw2ICsxMjksMjEgQEAKIAlidXNfZW51bWVyYXRlX2hpbnRlZF9j aGlsZHJlbihkZXYpOwogCiAJLyoKKwkgKiBDaGVjayBpZiB3ZSdyZSBydW5uaW5nIG9uIGEg UG93ZXJNYWMsIG5lZWRlZCBmb3IgdGhlIEkyQworCSAqIGFkZHJlc3MgYmVsb3cuCisJICov CisJcm9vdCA9IE9GX3BlZXIoMCk7CisJ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