Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Nov 2015 13:26:30 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Nathan Whitehorn <nwhitehorn@freebsd.org>
Cc:        Andreas Tobler <andreast@freebsd.org>, src-committers <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r290373 - head/sys/dev/ofw
Message-ID:  <CANCZdfriYN=JbN8uEsCh-CBZ9V8F5mcL_KaRXQBJZkKv-Gt3SQ@mail.gmail.com>
In-Reply-To: <563BB466.8020801@freebsd.org>
References:  <201511042246.tA4MkUYU010551@repo.freebsd.org> <563BB466.8020801@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
I'd suggested that this be driven off a global quirk like

u_int fdt_quirks;
#define FDT_QUIRK_8BIT_IIC_ADDR 1
...

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.

Warner


On Thu, Nov 5, 2015 at 12:56 PM, Nathan Whitehorn <nwhitehorn@freebsd.org>
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?
> -Nathan
>
> On 11/04/15 14:46, Andreas Tobler wrote:
>
>> Author: andreast
>> Date: Wed Nov  4 22:46:30 2015
>> New Revision: 290373
>> URL: https://svnweb.freebsd.org/changeset/base/290373
>>
>> Log:
>>    Add a compile time switch to distinguish between 7-bit and 8-bit I2C
>> address
>>    usage. The comment in the code should explain the situation.
>>       Discussed with:    ian@
>>
>> Modified:
>>    head/sys/dev/ofw/ofw_iicbus.c
>>
>> Modified: head/sys/dev/ofw/ofw_iicbus.c
>>
>> ==============================================================================
>> --- head/sys/dev/ofw/ofw_iicbus.c       Wed Nov  4 19:09:42 2015
>> (r290372)
>> +++ head/sys/dev/ofw/ofw_iicbus.c       Wed Nov  4 22:46:30 2015
>> (r290373)
>> @@ -148,10 +148,16 @@ ofw_iicbus_attach(device_t dev)
>>                 if (dinfo == NULL)
>>                         continue;
>>                 /*
>> -                * OFW uses 7-bit I2C address format (see ePAPR),
>> -                * but system expect 8-bit.
>> +                * FreeBSD drivers expect I2C addresses to be expressed as
>> +                * 8-bit values.  Apple OFW data contains 8-bit values,
>> but
>> +                * Linux FDT data contains 7-bit values, so shift them up
>> to
>> +                * 8-bit format.
>>                  */
>> +#ifdef AIM
>> +               dinfo->opd_dinfo.addr = paddr;
>> +#else
>>                 dinfo->opd_dinfo.addr = paddr << 1;
>> +#endif
>>                 if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child)
>> !=
>>                     0) {
>>                         free(dinfo, M_DEVBUF);
>>
>>
>
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfriYN=JbN8uEsCh-CBZ9V8F5mcL_KaRXQBJZkKv-Gt3SQ>