public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
@ 2011-12-01 15:48 ` bugzilla-daemon
  2011-12-01 15:52 ` bugzilla-daemon
                   ` (82 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2011-12-01 15:48 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ecos-patches@ecos.sourcewar
                   |                            |e.org
          Component|I2C                         |Patches and contributions
         OS/Version|Other                       |Cortex-M

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
  2011-12-01 15:48 ` [Bug 1001397] I2C driver for Kinetic microcontrollers bugzilla-daemon
@ 2011-12-01 15:52 ` bugzilla-daemon
  2011-12-01 15:58 ` bugzilla-daemon
                   ` (81 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2011-12-01 15:52 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |1001388

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
  2011-12-01 15:48 ` [Bug 1001397] I2C driver for Kinetic microcontrollers bugzilla-daemon
  2011-12-01 15:52 ` bugzilla-daemon
@ 2011-12-01 15:58 ` bugzilla-daemon
  2011-12-13 15:13 ` bugzilla-daemon
                   ` (80 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2011-12-01 15:58 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #2 from Tomas Frydrych <tf+bugs.ecos@r-finger.com> 2011-12-01 15:58:38 GMT ---
There is no rush, I just wanted to get this out, in case there are any formal
changes required. I am working on an a driver for the MMA7660 accelerometer
(included on the TWR boards), which provides one way of testing i2c in both
directions; it's not ready yet, but not far off. I'll post that into a separate
bug eventually.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (2 preceding siblings ...)
  2011-12-01 15:58 ` bugzilla-daemon
@ 2011-12-13 15:13 ` bugzilla-daemon
  2011-12-23 10:41 ` bugzilla-daemon
                   ` (79 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2011-12-13 15:13 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Tomas Frydrych <tf+bugs.ecos@r-finger.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |1001419

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (3 preceding siblings ...)
  2011-12-13 15:13 ` bugzilla-daemon
@ 2011-12-23 10:41 ` bugzilla-daemon
  2011-12-23 13:28 ` bugzilla-daemon
                   ` (78 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2011-12-23 10:41 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #3 from Tomas Frydrych <tf+bugs.ecos@r-finger.com> 2011-12-23 10:40:41 GMT ---
In the light of the discussion in bug 1001428, I think the hal bits in this
patch should be moved under hal/misc/freescale/i2c?

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (4 preceding siblings ...)
  2011-12-23 10:41 ` bugzilla-daemon
@ 2011-12-23 13:28 ` bugzilla-daemon
  2011-12-23 14:14 ` bugzilla-daemon
                   ` (77 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2011-12-23 13:28 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

John Dallaway <john@dallaway.org.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john@dallaway.org.uk

--- Comment #4 from John Dallaway <john@dallaway.org.uk> 2011-12-23 13:27:33 GMT ---
(In reply to comment #3)
> In the light of the discussion in bug 1001428, I think the hal bits in this
> patch should be moved under hal/misc/freescale/i2c?

Tomas, will this package be applicable to _all_ Freescale I2C peripheral blocks
across all Freescale product families? If not, please make the "i2c" directory
name (and corresponding eCos package name) less generic. In an ideal world, all
peripheral blocks which are shared across multiple architectures would have
unique names assigned by the manufacturer.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (5 preceding siblings ...)
  2011-12-23 13:28 ` bugzilla-daemon
@ 2011-12-23 14:14 ` bugzilla-daemon
  2011-12-23 14:15 ` bugzilla-daemon
                   ` (76 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2011-12-23 14:14 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #5 from Ilija Kocho <ilijak@siva.com.mk> 2011-12-23 14:12:07 GMT ---
(In reply to comment #3)
> In the light of the discussion in bug 1001428, I think the hal bits in this
> patch should be moved under hal/misc/freescale/i2c?

(In reply to comment #3)
> In the light of the discussion in bug 1001428, I think the hal bits in this
> patch should be moved under hal/misc/freescale/i2c?


I assume you are referring to i2c header. They should stay with driver source,
either in driver .c file or (preferably) in a header.
As there is existing devs/i2c directory, I propose following path:
    - devs/i2c/freescale/<freescale_i2c>

where <freescale_i2c> is the name of this particular freescale spi instance
(typically as referred to in ref. man.).

Besides the device structure itself, there is some information provided by HAL
(base address(es), pin configuration or so. They can be be considered variant
or platform dependent and so defined in var_io_devs.h and/or plf_io.h
respectively. If defined in both then plf shall override var.

I hope in future to produce some docs but in meantime pse refer to ENET driver
for example.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (6 preceding siblings ...)
  2011-12-23 14:14 ` bugzilla-daemon
@ 2011-12-23 14:15 ` bugzilla-daemon
  2011-12-24  9:22 ` bugzilla-daemon
                   ` (75 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2011-12-23 14:15 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #6 from Ilija Kocho <ilijak@siva.com.mk> 2011-12-23 14:15:09 GMT ---
(In reply to comment #5)
> (In reply to comment #3)
> > In the light of the discussion in bug 1001428, I think the hal bits in this
> > patch should be moved under hal/misc/freescale/i2c?
> 
> (In reply to comment #3)
> > In the light of the discussion in bug 1001428, I think the hal bits in this
> > patch should be moved under hal/misc/freescale/i2c?
> 
> 
> I assume you are referring to i2c header. They should stay with driver source,
> either in driver .c file or (preferably) in a header.
> As there is existing devs/i2c directory, I propose following path:
>     - devs/i2c/freescale/<freescale_i2c>
> 
(Just to clarify this is path to device that will have usual subtree
             <version>/cdl
                      /include
                      /src
                      /ChangeLog

> where <freescale_i2c> is the name of this particular freescale spi instance
> (typically as referred to in ref. man.).
> 
> Besides the device structure itself, there is some information provided by HAL
> (base address(es), pin configuration or so. They can be be considered variant
> or platform dependent and so defined in var_io_devs.h and/or plf_io.h
> respectively. If defined in both then plf shall override var.
> 
> I hope in future to produce some docs but in meantime pse refer to ENET driver
> for example.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (7 preceding siblings ...)
  2011-12-23 14:15 ` bugzilla-daemon
@ 2011-12-24  9:22 ` bugzilla-daemon
  2011-12-24 11:59 ` bugzilla-daemon
                   ` (74 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2011-12-24  9:22 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #7 from Tomas Frydrych <tf+bugs.ecos@r-finger.com> 2011-12-24 09:21:52 GMT ---
(In reply to comment #5)
> As there is existing devs/i2c directory, I propose following path:
>     - devs/i2c/freescale/<freescale_i2c>

OK, but the situation is exactly the same for the SLCD controller, and so we
end up with bits under devs/ and bits under hal/misc, with no clear logic for
the distinction I can see.


> where <freescale_i2c> is the name of this particular freescale spi instance
> (typically as referred to in ref. man.).

The services have only generic names in the Freescale RMs, so we end up with
very generic names. That is fine if Freescale only make a single i2c controller
and never will design another one, perhaps that is the case?

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (8 preceding siblings ...)
  2011-12-24  9:22 ` bugzilla-daemon
@ 2011-12-24 11:59 ` bugzilla-daemon
  2011-12-26  7:32 ` bugzilla-daemon
                   ` (73 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2011-12-24 11:59 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #8 from Ilija Kocho <ilijak@siva.com.mk> 2011-12-24 11:58:57 GMT ---
(In reply to comment #7)
> (In reply to comment #5)
> > As there is existing devs/i2c directory, I propose following path:
> >     - devs/i2c/freescale/<freescale_i2c>
> 
> OK, but the situation is exactly the same for the SLCD controller, and so we
> end up with bits under devs/ and bits under hal/misc, with no clear logic for
> the distinction I can see.
> 

We need to distinguish/combine two sources of information:
   Device structure (registers, bits)
   Device instantiation (base address, pins, etc).

Device structure is needed only by the driver and should live there (in
driver's .c file or in a header file). Also the naming should be in device name
space, common patterns are: CYGHWR_IO_I2C_FREESCALE_I2C_xxxx or
CYGHWR_DEV_I2C_FREESCALE_I2C_xxx 

Device instants are HAL dependent, hence var_io_devs.h or plf_io.h.

Example:
var_io_devs.h -----------------------------

#define CYGHWR_IO_I2C_FREESCALE_I2C1_P \
((cyghwr_io_i2c_freescale_i2c_t*)0x40067000)

--------------------------------------------

plf_io.h -----------------------------------

#define CYGHWR_IO_I2C_FREESCALE_I2C0_PIN_SDA CYGHWR_HAL_KINETIS_PIN(D, 9, 2, 0)

--------------------------------------------

>
> > where <freescale_i2c> is the name of this particular freescale spi instance
> > (typically as referred to in ref. man.).
> 
> The services have only generic names in the Freescale RMs, so we end up with
> very generic names. That is fine if Freescale only make a single i2c controller
> and never will design another one, perhaps that is the case?

It seem that to be the case with i2c. I checked Coldfire+ seem to have the same
i2c but PXN have some older version looks like some bits match but probably not
all. Maybe we can use i2c now and if there's next entry with generic name we
add the new device name some suffix/prefix.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (9 preceding siblings ...)
  2011-12-24 11:59 ` bugzilla-daemon
@ 2011-12-26  7:32 ` bugzilla-daemon
  2012-01-01 21:13 ` bugzilla-daemon
                   ` (72 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2011-12-26  7:32 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #9 from Tomas Frydrych <tf+bugs.ecos@r-finger.com> 2011-12-26 07:32:13 GMT ---
Thanks Ilija, I will prepare an updated patch sometime next week.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (10 preceding siblings ...)
  2011-12-26  7:32 ` bugzilla-daemon
@ 2012-01-01 21:13 ` bugzilla-daemon
  2012-01-10 15:40 ` bugzilla-daemon
                   ` (71 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-01-01 21:13 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Bug 1001397 depends on bug 1001388, which changed state.

Bug 1001388 Summary: Convenience macros for manipulating GPIO pins
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001388

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |CURRENTRELEASE

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (11 preceding siblings ...)
  2012-01-01 21:13 ` bugzilla-daemon
@ 2012-01-10 15:40 ` bugzilla-daemon
  2012-01-11 20:33 ` bugzilla-daemon
                   ` (70 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-01-10 15:40 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Tomas Frydrych <tf+bugs.ecos@r-finger.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #1443|0                           |1
        is obsolete|                            |

--- Comment #10 from Tomas Frydrych <tf+bugs.ecos@r-finger.com> 2012-01-10 15:40:21 GMT ---
Created an attachment (id=1507)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=1507)
Freescale i2c driver

Moved the device driver code under devs/i2c/freescale/i2c and cleaned up the
driver implementation.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (12 preceding siblings ...)
  2012-01-10 15:40 ` bugzilla-daemon
@ 2012-01-11 20:33 ` bugzilla-daemon
  2012-01-16 14:31 ` bugzilla-daemon
                   ` (69 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-01-11 20:33 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #11 from Ilija Kocho <ilijak@siva.com.mk> 2012-01-11 20:32:34 GMT ---
Hi Tomas, thank you for the update and here are my first notes:

ISR priority
Cortex-M NVIC implements priority arbitration with most significant /n/ bits
implemented. Consequently in Kinetis (4 bits) they are bits 7..4 so priorities
range 0x00, 0x10,..,0xf0. But this is not end of the story for eCos. Please
visit this thread for full explanation (both references and follow-ups):
http://ecos.sourceware.org/ml/ecos-devel/2010-11/msg00007.html

It would be good to have configurable ISR priority. I understand that some
drivers do not provide such control, but IMO that ISR priority manipulation may
be important for tuning system behavior. And it is just a cdl per bus.

I2C buses
It would be good that unused buses are inactive - not present. Then user (or
higher level I2C driver) activates the necessary bus by implementing respective
interface. 

Also some parameters such as speed should be private to the bus. I can imagine
two devices using separate buses at different speeds simultaneously.

Also we don't need 2 init functions. Instead you can place parameters such as
CYGHWR_IO_I2C_FREESCALE_I2Cx_PIN_SDA, etc. in the bus structure (or some const
if you wish to save some RAM).

Ilija

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (13 preceding siblings ...)
  2012-01-11 20:33 ` bugzilla-daemon
@ 2012-01-16 14:31 ` bugzilla-daemon
  2012-02-07 20:38 ` bugzilla-daemon
                   ` (68 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-01-16 14:31 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Tomas Frydrych <tf+bugs.ecos@r-finger.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #1507|0                           |1
        is obsolete|                            |

--- Comment #12 from Tomas Frydrych <tf+bugs.ecos@r-finger.com> 2012-01-16 14:30:33 GMT ---
Created an attachment (id=1519)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=1519)
Freescale i2c driver

Updated patch:

 * made bus presence, bus speed and isr priority configurable,
 * only one kinetis_i2c_init() function.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (14 preceding siblings ...)
  2012-01-16 14:31 ` bugzilla-daemon
@ 2012-02-07 20:38 ` bugzilla-daemon
  2012-02-08  9:12 ` bugzilla-daemon
                   ` (67 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-02-07 20:38 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #13 from Ilija Kocho <ilijak@siva.com.mk> 2012-02-07 20:37:36 GMT ---
Hi Tomas

I'm sorry for this delay.

You have placed things such as IRQ priorities in HAL rather than with device
CDL which is not an usual practice. On second consideration I realized that it
is good to have IRQ priorities at HAL because they are being resolved by HAL
(NVIC). Next step was a logical consequence: Why not consolidate all IRQ
priorities and put them togeteher. Anyway it's not priority what counts but
relative priority differences between IRQs.So I introduced the same to all
drivers and it took some time.
You can find update at bug Bug 1001450.

Now little discussion on your driver. Recently I worked on DSPI so this
quiestion is based on that experience and it may or may not have snse here:
    -Can I2C clock be defined on device basis like at SPI?
Next is general, could it be possible to provide user with option to set I2C
speed (clock) rather than prescaler value?

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (15 preceding siblings ...)
  2012-02-07 20:38 ` bugzilla-daemon
@ 2012-02-08  9:12 ` bugzilla-daemon
  2012-02-08  9:55 ` bugzilla-daemon
                   ` (66 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-02-08  9:12 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #14 from Tomas Frydrych <tf+bugs.ecos@r-finger.com> 2012-02-08 09:12:22 GMT ---
(In reply to comment #13)
>     -Can I2C clock be defined on device basis like at SPI?

Yes, I think it should be possible to change the bus speed when the device
takes over the mastership of the bus, I shall look into that.

> Next is general, could it be possible to provide user with option to set I2C
> speed (clock) rather than prescaler value?

I can't see any way to translate the SCL/SDA values that are need to calculate
the i2c speed into the MUL + ICR values that need to go into the frequency
divider register; the RM just provides a one big LUT for this.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (16 preceding siblings ...)
  2012-02-08  9:12 ` bugzilla-daemon
@ 2012-02-08  9:55 ` bugzilla-daemon
  2012-02-11  0:16 ` bugzilla-daemon
                   ` (65 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-02-08  9:55 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #15 from Ilija Kocho <ilijak@siva.com.mk> 2012-02-08 09:54:55 GMT ---
(In reply to comment #14)
> (In reply to comment #13)
> >     -Can I2C clock be defined on device basis like at SPI?
> 
> Yes, I think it should be possible to change the bus speed when the device
> takes over the mastership of the bus, I shall look into that.
> 
> > Next is general, could it be possible to provide user with option to set I2C
> > speed (clock) rather than prescaler value?
> 
> I can't see any way to translate the SCL/SDA values that are need to calculate
> the i2c speed into the MUL + ICR values that need to go into the frequency
> divider register; the RM just provides a one big LUT for this.

Yeah, it's kind of reverse calculation. I had similar problem with SPI and I
use a brute force algorithm. But some SPI devices (example MMC) want to set
speed on their own so having this calculation is necessary anyway. In I2C world
it may be not the case (frankly, I have no insight) so it could be just "nice"
but not mandatory.

Ilija

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (17 preceding siblings ...)
  2012-02-08  9:55 ` bugzilla-daemon
@ 2012-02-11  0:16 ` bugzilla-daemon
  2012-02-11 10:14 ` bugzilla-daemon
                   ` (64 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-02-11  0:16 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #16 from Ilija Kocho <ilijak@siva.com.mk> 2012-02-11 00:15:45 GMT ---
Some lines (such as some macros in i2c_freescale.h) are too long. General rule
is that lines are below 78 characters. Somewhat longer lines can be accepted
for macros or in CDL but these are too long. Please reformat.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (18 preceding siblings ...)
  2012-02-11  0:16 ` bugzilla-daemon
@ 2012-02-11 10:14 ` bugzilla-daemon
  2012-02-12 19:11 ` bugzilla-daemon
                   ` (63 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-02-11 10:14 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #17 from Tomas Frydrych <tf+bugs.ecos@r-finger.com> 2012-02-11 10:14:24 GMT ---
Will do; also just noticed the priority level for the IRQs is incorrectly
defined in the cdl (should be 0, 0x10, 0x20, etc.), so will fix that as well.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (19 preceding siblings ...)
  2012-02-11 10:14 ` bugzilla-daemon
@ 2012-02-12 19:11 ` bugzilla-daemon
  2012-02-12 19:11 ` bugzilla-daemon
                   ` (62 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-02-12 19:11 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Tomas Frydrych <tf+bugs.ecos@r-finger.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|1001388                     |1001450

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (20 preceding siblings ...)
  2012-02-12 19:11 ` bugzilla-daemon
@ 2012-02-12 19:11 ` bugzilla-daemon
  2012-02-23 16:11 ` bugzilla-daemon
                   ` (61 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-02-12 19:11 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Tomas Frydrych <tf+bugs.ecos@r-finger.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #1519|0                           |1
        is obsolete|                            |

--- Comment #18 from Tomas Frydrych <tf+bugs.ecos@r-finger.com> 2012-02-12 19:10:38 GMT ---
Created an attachment (id=1571)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=1571)
Kinetis i2c driver

Updated patch:

 * rebased on top of bug 1001450,
 * integrated with the new ISR priority scheme,
 * fixed ISR priority values in the cdl, comment 17,
 * fixed the long lines in i2c_freescale.h, comment 16,

I have not yet had the time to address the issues raised in comment 13 (per
device configuratble bus speed; setting clock speed rather than prescaler), but
thought it is worth to update the patch here anyway.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (21 preceding siblings ...)
  2012-02-12 19:11 ` bugzilla-daemon
@ 2012-02-23 16:11 ` bugzilla-daemon
  2012-03-20 15:17 ` bugzilla-daemon
                   ` (60 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-02-23 16:11 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #19 from Ilija Kocho <ilijak@siva.com.mk> 2012-02-23 16:11:04 GMT ---
Please check against current CVS and synchronize if necessary.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (22 preceding siblings ...)
  2012-02-23 16:11 ` bugzilla-daemon
@ 2012-03-20 15:17 ` bugzilla-daemon
  2012-03-31 17:17 ` bugzilla-daemon
                   ` (59 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-03-20 15:17 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Tomas Frydrych <tf+bugs.ecos@r-finger.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #1571|0                           |1
        is obsolete|                            |

--- Comment #20 from Tomas Frydrych <tf+bugs.ecos@r-finger.com> 2012-03-20 15:16:45 GMT ---
Created an attachment (id=1653)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=1653)
Kinetis i2c driver

I have updated the patch against the current cvs, as well as implemented a
per-device bus speed configuration.

However, I left the cdls and API to use the MULT+ICR values (as per 50.3.2 and
50.4.1.10 of the RM) rather then actual frequency -- the ICR value is a
function of multiple parameters, and there seems to be no obvious way to
conjure it up from frequency alone.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (23 preceding siblings ...)
  2012-03-20 15:17 ` bugzilla-daemon
@ 2012-03-31 17:17 ` bugzilla-daemon
  2012-05-04 18:17 ` bugzilla-daemon
                   ` (58 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-03-31 17:17 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #21 from Ilija Kocho <ilijak@siva.com.mk> 2012-03-31 18:17:18 BST ---
(In reply to comment #20)
> Created an attachment (id=1653)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=1653) [details]
> Kinetis i2c driver
> 
> I have updated the patch against the current cvs, as well as implemented a
> per-device bus speed configuration.
> 
> However, I left the cdls and API to use the MULT+ICR values (as per 50.3.2 and
> 50.4.1.10 of the RM) rather then actual frequency -- the ICR value is a
> function of multiple parameters, and there seems to be no obvious way to
> conjure it up from frequency alone.

There is a conflict that requires at least one active I2C bus:

18:46:30> ecosconfig new twr_k60n512
U CYGHWR_HAL_CORTEXM, new inferred value M4
U CYGHWR_HAL_CORTEXM_SYSTICK_CLK_SOURCE, new inferred value INTERNAL
C CYGPKG_DEVS_I2C_FREESCALE_I2C, "requires" constraint not satisfied:
CYGINT_HAL_FREESCALE_I2C_BUS
18:46:30>

Probably something like following would be best fix, but unfortunately
configtool crashes when I try to activate an I2C bus:

--- i2c_freescale_org.cdl    2012-03-31 18:15:45.364128606 +0200
+++ i2c_freescale.cdl    2012-03-31 18:53:28.388222427 +0200
@@ -46,10 +46,17 @@
 #####DESCRIPTIONEND####
 # ====================================================================

+cdl_interface CYGINT_HAL_FREESCALE_I2C_BUS {
+    display      "Number of I2C buses"
+}
+    
 cdl_package CYGPKG_DEVS_I2C_FREESCALE_I2C {
     display       "I2C driver for Freescale Kinetis and ColdFire+ chips"
     parent        CYGPKG_IO_I2C
     requires      CYGPKG_IO_I2C
+    
+    active_if     CYGINT_HAL_FREESCALE_I2C_BUS
+    
     include_dir   cyg/io
     description   "
         This package provides a generic I2C device driver for the on-chip
@@ -57,12 +64,6 @@

     compile       -library=libextras.a i2c_freescale.c

-    cdl_interface CYGINT_HAL_FREESCALE_I2C_BUS {
-        display      "Number of I2C buses"
-    }
-
-    requires CYGINT_HAL_FREESCALE_I2C_BUS
-
     cdl_option CYGPKG_DEVS_I2C_FREESCALE_I2C_TRACE {
         display       "I2C trace"
         flavor        bool

Then I tried the following:

--- i2c_freescale_org.cdl    2012-03-31 18:15:45.364128606 +0200
+++ i2c_freescale.cdl    2012-03-31 18:56:09.916229122 +0200
@@ -46,10 +46,17 @@
 #####DESCRIPTIONEND####
 # ====================================================================

+cdl_interface CYGINT_HAL_FREESCALE_I2C_BUS {
+    display      "Number of I2C buses"
+}
+    
 cdl_package CYGPKG_DEVS_I2C_FREESCALE_I2C {
     display       "I2C driver for Freescale Kinetis and ColdFire+ chips"
     parent        CYGPKG_IO_I2C
     requires      CYGPKG_IO_I2C
+
+    requires      CYGPKG_HAL_CORTEXM_KINETIS
+
     include_dir   cyg/io
     description   "
         This package provides a generic I2C device driver for the on-chip
@@ -57,12 +64,6 @@

     compile       -library=libextras.a i2c_freescale.c

-    cdl_interface CYGINT_HAL_FREESCALE_I2C_BUS {
-        display      "Number of I2C buses"
-    }
-
-    requires CYGINT_HAL_FREESCALE_I2C_BUS
-
     cdl_option CYGPKG_DEVS_I2C_FREESCALE_I2C_TRACE {
         display       "I2C trace"
         flavor        bool

I hope you'll find better fix, otherwise If this is good enough I could prepare
updated patch.

Ilija

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (24 preceding siblings ...)
  2012-03-31 17:17 ` bugzilla-daemon
@ 2012-05-04 18:17 ` bugzilla-daemon
  2012-12-21 20:46 ` bugzilla-daemon
                   ` (57 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-05-04 18:17 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Bug 1001397 depends on bug 1001450, which changed state.

Bug 1001450 Summary: Kinetis HAL and driver upgrade
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001450

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |CURRENTRELEASE

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (25 preceding siblings ...)
  2012-05-04 18:17 ` bugzilla-daemon
@ 2012-12-21 20:46 ` bugzilla-daemon
  2012-12-24  9:52 ` bugzilla-daemon
                   ` (56 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-12-21 20:46 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #22 from Ilija Kocho <ilijak@siva.com.mk> 2012-12-21 20:46:39 GMT ---
Tomas

I am trying to clean up my backlog. Your I2C driver appears to be almost ready
for check in. I wander if you have tried the patch proposed in comment 21.

Ilija

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (26 preceding siblings ...)
  2012-12-21 20:46 ` bugzilla-daemon
@ 2012-12-24  9:52 ` bugzilla-daemon
  2012-12-24 16:53 ` bugzilla-daemon
                   ` (55 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-12-24  9:52 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #23 from Tomas Frydrych <tf+bugs.ecos@r-finger.com> 2012-12-24 09:52:31 GMT ---
(In reply to comment #22)
> I am trying to clean up my backlog. Your I2C driver appears to be almost ready
> for check in. I wander if you have tried the patch proposed in comment 21.

The patch makes sense to me, though I have not had a chance to test it.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (27 preceding siblings ...)
  2012-12-24  9:52 ` bugzilla-daemon
@ 2012-12-24 16:53 ` bugzilla-daemon
  2012-12-24 16:54 ` bugzilla-daemon
                   ` (54 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-12-24 16:53 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #1653|0                           |1
        is obsolete|                            |

--- Comment #24 from Ilija Kocho <ilijak@siva.com.mk> 2012-12-24 16:53:06 GMT ---
Created an attachment (id=2004)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=2004)
Freescale I2C driver 121224

Here is the driver with applied patch from comment 21 and synced with CVS as of
2012.12.24.

This patch contains only the I2C driver. HAL and ecos.db are in separated
diffs.

Ilija

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (28 preceding siblings ...)
  2012-12-24 16:53 ` bugzilla-daemon
@ 2012-12-24 16:54 ` bugzilla-daemon
  2012-12-24 16:56 ` bugzilla-daemon
                   ` (53 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-12-24 16:54 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #25 from Ilija Kocho <ilijak@siva.com.mk> 2012-12-24 16:54:24 GMT ---
Created an attachment (id=2005)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=2005)
Freescale I2C Kinetis HAL files

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (29 preceding siblings ...)
  2012-12-24 16:54 ` bugzilla-daemon
@ 2012-12-24 16:56 ` bugzilla-daemon
  2012-12-24 16:56 ` bugzilla-daemon
                   ` (52 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-12-24 16:56 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #26 from Ilija Kocho <ilijak@siva.com.mk> 2012-12-24 16:55:52 GMT ---
Created an attachment (id=2006)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=2006)
Freescale I2C driver ecos.db patch 121224

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (30 preceding siblings ...)
  2012-12-24 16:56 ` bugzilla-daemon
@ 2012-12-24 16:56 ` bugzilla-daemon
  2012-12-24 17:14 ` bugzilla-daemon
                   ` (51 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-12-24 16:56 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2005|Freescale I2C Kinetis HAL   |Freescale I2C Kinetis HAL
        description|files                       |121224

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (31 preceding siblings ...)
  2012-12-24 16:56 ` bugzilla-daemon
@ 2012-12-24 17:14 ` bugzilla-daemon
  2012-12-24 17:38 ` bugzilla-daemon
                   ` (50 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-12-24 17:14 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEEDINFO
     Ever Confirmed|0                           |1

--- Comment #27 from Ilija Kocho <ilijak@siva.com.mk> 2012-12-24 17:14:00 GMT ---
Hi Tomas

Thank you for your reply.

(In reply to comment #23)
> (In reply to comment #22)
> > I am trying to clean up my backlog. Your I2C driver appears to be almost ready
> > for check in. I wander if you have tried the patch proposed in comment 21.
> 
> The patch makes sense to me, though I have not had a chance to test it.

As you may have seen I took the liberty to apply the patch from comment 21. It
compiles fine, but I haven't tested the runtime.

One thing that bothers me is the WAIT_BUS_READY(), it looks like busy waiting,
but I can't estimate implications since I don't have enough insight into
I2C. Can you comment on this please?

Thanks
Ilija

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (32 preceding siblings ...)
  2012-12-24 17:14 ` bugzilla-daemon
@ 2012-12-24 17:38 ` bugzilla-daemon
  2012-12-25 21:32 ` bugzilla-daemon
                   ` (49 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-12-24 17:38 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Mike Jones <mjones@linear.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mjones@linear.com

--- Comment #28 from Mike Jones <mjones@linear.com> 2012-12-24 17:38:26 GMT ---
I can make a couple of comments based on my experience with K60 and the
Freescale POSIX I2C driver and a real application.

First is the issue of using the interrupt driver vs polling driver. I use the
interrupt driver so that other tasks can operate while waiting. My application
is PMBus, and clock stretching can slow things down, so I figure I don't want
to be in a polling loop.

Second, is the issue of polling on bits. I discovered that the Freescale driver
polls on bits at times, even when using the interrupt driver. This causes some
serious problems in real use. I'll give an example.

When multimastering, it is always possible to have a misbehaving master. I have
one of these, and it basically breaks the rules and asserts the clock or data
line randomly.

Because I can't predict what master might misbehave, I tried to make the
telemetry task immune to this. What I did was create a watchdog. Since most of
my PMBus/I2C transactions are telemetry, it is easy to do. When the misbehaving
master does its deed, I found the I2C driver got stuck in a polling loop on a
bit, even though it was in interrupt driver.

Once in this condition, you are helpless to get out of the loop without
modifying the driver code, because it does not have a counter/timeout on the
loop. The driver assumes the other masters and slaves follow the rules.

So my watchdog kills the task and tries to recover. This means my code has to
clean up the I2C driver state either by reopening the device, or manually. This
proved a bit difficult because in MQX once you are stuck in this loop, you
can't clean up mutexes from a different task. So you have a catch 22. If you
don't kill it, you can't get out of the loop and have it clean up. And if you
kill it, you can't clean up because you don't have permission. 

So I had to create tasks that did not own the resources so I could kill the
task and clean up. Then I restart the task.

This is a pretty nasty way to deal with the problem, but it does in fact work.
In general, a bad master will not be a permanent state of affairs. A bad master
is probably someone putting a USB based dongle on the bus for debug,
programming, etc. A production hardware will probably behave, but even then, in
High Availability systems, one may still want to try to recover.

So potential solutions are to have driver calls that timeout or driver calls
that when stuck, can easily be cleared. If a watchdog can make a call to cause
the driver to break its loop and return an error, one can solve the stuck loop
that was as well. If you use a timeout, it is best to remain compliant with
PMBus/SMBus and set the loops to timeout on a specific time, and best if you
use a hardware timer so the loop does not consume the CPU. From my point of
view this just suggests making a easy way for the watchdog to kill the stuck
loop at clean up so that the time function is under the application's control.
But I would still use an interrupt approach in general for those things where
the I2C peripheral supports it. I don't know why and when people use the
Freescale polled driver. Perhaps there is a case where other uses of interrupts
makes this a problem. So I guess for completeness you could do both.

The Freescale driver code is publicly available for inspection. I am not
familiar with it.

The last thing I will say is that a good I2C driver will open up opportunities
for eCos. eCos would be a good choice for implementing IPMI Board Controllers,
which is my area of interest.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (33 preceding siblings ...)
  2012-12-24 17:38 ` bugzilla-daemon
@ 2012-12-25 21:32 ` bugzilla-daemon
  2012-12-25 21:33 ` bugzilla-daemon
                   ` (48 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-12-25 21:32 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #29 from Ilija Kocho <ilijak@siva.com.mk> 2012-12-25 21:31:55 GMT ---
(In reply to comment #27)

Hi again Tomas

> 
> Thank you for your reply.
> 
> (In reply to comment #23)
> > (In reply to comment #22)
> > > I am trying to clean up my backlog. Your I2C driver appears to be almost ready
> > > for check in. I wander if you have tried the patch proposed in comment 21.
> > 
> > The patch makes sense to me, though I have not had a chance to test it.
> 
> As you may have seen I took the liberty to apply the patch from comment 21. It
> compiles fine, but I haven't tested the runtime.
> 
> One thing that bothers me is the WAIT_BUS_READY(), it looks like busy waiting,
> but I can't estimate implications since I don't have enough insight into
> I2C. Can you comment on this please?

I looked through other I2C drivers and I found out that some of them have
similar macro. So we have a precedent, but I would look for better solution.
For instance what would happen if we replace the macro with something like this
(untested):

bool is_bus_free(freescale_i2c_extra *extra )
{
    bool bus_free;
    if (!extra->i2c_owner) {
        freescale_i2c_t *i2c_s = FREESCALE_I2C_P(extra->i2c_base);
        if(i2c_s->s & FREESCALE_I2C_S_BUSY_M){
            bus_free = false;
        } else {
            extra->i2c_got_nack = 0;
            extra->i2c_owner = 1;
            bus_free = true;
        }
    } else {
        bus_free = true;
    }
    return bus_free;
}

Then something like this:

static cyg_bool
freescale_i2c_handle_xfer(const cyg_i2c_device * dev, int address)
{
  freescale_i2c_device *fdev = (freescale_i2c_device*) dev;
  freescale_i2c_extra  *extra = (freescale_i2c_extra *)
dev->i2c_bus->i2c_extra;
  cyg_uint8             data = *extra->i2c_data.i2c_tx_data;
  freescale_i2c_t      *i2c_s = FREESCALE_I2C_P (extra->i2c_base);

  // Nothing to do
  if (extra->i2c_count == 0)
    return 0;

-  // Take the bus ownership
-  WAIT_BUS_READY (extra);
+  // Check the bus ownership
+  if(!is_bus_free(extra))
+    return 0;

  .....

}

Ilija

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (34 preceding siblings ...)
  2012-12-25 21:32 ` bugzilla-daemon
@ 2012-12-25 21:33 ` bugzilla-daemon
  2012-12-25 23:38 ` bugzilla-daemon
                   ` (47 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-12-25 21:33 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #30 from Ilija Kocho <ilijak@siva.com.mk> 2012-12-25 21:33:38 GMT ---
Hi Mike, thank you for your considerations.

(In reply to comment #28)
> I can make a couple of comments based on my experience with K60 and the
> Freescale POSIX I2C driver and a real application.
> 
> First is the issue of using the interrupt driver vs polling driver. I use the
> interrupt driver so that other tasks can operate while waiting. My application
> is PMBus, and clock stretching can slow things down, so I figure I don't want
> to be in a polling loop.

Polling is not an issue with eCos I2C driver. It is interrupt driven indeed.

My question is about the macro WAIT_BUS_READY() and my concern is for
multi-master system since, in a single master system it is returns immediately.

Perhaps you could give it a try in your environment. Any feedback is
appreciated.

Ilija

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (35 preceding siblings ...)
  2012-12-25 21:33 ` bugzilla-daemon
@ 2012-12-25 23:38 ` bugzilla-daemon
  2012-12-26 15:06 ` bugzilla-daemon
                   ` (46 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-12-25 23:38 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #31 from Mike Jones <mjones@linear.com> 2012-12-25 23:37:55 GMT ---
I think that looping on bus ready is probably ok if there is a SMBus like
timeout of 25ms to 30ms, and as long as the scheduler can break in switch
tasks. If the wait can't be interrupted by the scheduler it is more problematic
when the bus is stuck. 

A worst case scenario might have a task for ALERTB and one for telemetry. The
second master hogs the bus and the first master is having trouble getting in.
The the ALERTB comes along and needs immediate service. The ALERTB task may
flip a GPIO bit and kill power, or it may wait for the timeout and then attempt
to use the bus.

All that matters to me is that it the driver waits for the bus to be free,
times out, and allows a higher priority task do its job while waiting. I would
not want it to just return because the bus is busy and force me to write my own
timeout. And I would not want it to hang forever if a second master was beating
the bus to death.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (36 preceding siblings ...)
  2012-12-25 23:38 ` bugzilla-daemon
@ 2012-12-26 15:06 ` bugzilla-daemon
  2012-12-29 14:24 ` bugzilla-daemon
                   ` (45 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-12-26 15:06 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #32 from Ilija Kocho <ilijak@siva.com.mk> 2012-12-26 15:05:59 GMT ---
(In reply to comment #31)
> I think that looping on bus ready is probably ok if there is a SMBus like
> timeout of 25ms to 30ms, and as long as the scheduler can break in switch
> tasks. If the wait can't be interrupted by the scheduler it is more problematic
> when the bus is stuck. 

I2C thread normally shall be pre-empted by threads with higher priority than
itself. With current code this implies that I2C thread has to run with
relatively low priority. Probably it would be better if the priority is
(dynamically) decreased during spinning.

> 
> A worst case scenario might have a task for ALERTB and one for telemetry. The
> second master hogs the bus and the first master is having trouble getting in.
> The the ALERTB comes along and needs immediate service. The ALERTB task may
> flip a GPIO bit and kill power, or it may wait for the timeout and then attempt
> to use the bus.
> 
> All that matters to me is that it the driver waits for the bus to be free,
> times out, and allows a higher priority task do its job while waiting. I would
> not want it to just return because the bus is busy and force me to write my own
> timeout. And I would not want it to hang forever if a second master was beating
> the bus to death.

Timeout may be useful in general and it can be added as well.

Ilija

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (37 preceding siblings ...)
  2012-12-26 15:06 ` bugzilla-daemon
@ 2012-12-29 14:24 ` bugzilla-daemon
  2013-01-02  3:48 ` bugzilla-daemon
                   ` (44 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2012-12-29 14:24 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #33 from Ilija Kocho <ilijak@siva.com.mk> 2012-12-29 14:23:42 GMT ---
(In reply to comment #23)
> (In reply to comment #22)
> > I am trying to clean up my backlog. Your I2C driver appears to be almost ready
> > for check in. I wander if you have tried the patch proposed in comment 21.
> 
> The patch makes sense to me, though I have not had a chance to test it.

Hi Tomas

If you are too busy, and if you don't have objections, I would like to take
care of the spin optimization (ref. comment 32), of course with all respect and
credit to your contribution.

Ilija

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (38 preceding siblings ...)
  2012-12-29 14:24 ` bugzilla-daemon
@ 2013-01-02  3:48 ` bugzilla-daemon
  2013-01-02  7:07 ` bugzilla-daemon
                   ` (43 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-01-02  3:48 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #34 from Mike Jones <mjones@linear.com> 2013-01-02 03:48:27 GMT ---
Can some one provide some simple code examples? I have the patches installed, a
project ready for code, and hardware with I2C devices known to work using my
hardware and Freescale code tools. I'll read the reference manual for the
target independent API, but I am not sure that applies for the current patch or
if I have to use the i2c_freescale.h stuff, or a combination, etc. And the
i2c_freescale.h API does not describe the parameters, so if I need to use that,
it would help to have names of the parameters and some explanation, especially
for bools. I know I can reverse engineer the code, but I am hoping I don't have
to :-)

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (39 preceding siblings ...)
  2013-01-02  3:48 ` bugzilla-daemon
@ 2013-01-02  7:07 ` bugzilla-daemon
  2013-01-03  9:09 ` bugzilla-daemon
                   ` (42 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-01-02  7:07 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #35 from Mike Jones <mjones@linear.com> 2013-01-02 07:07:14 GMT ---
I read the reference on I2C. I am pretty clear how the standard I2C API works
in terms of making transactions using locking, etc.

I am making a simple app with no tasks, just to run in main. I assume there is
some magic for making a cyg_i2c_bus and then you can make some cyg_i2c_device.
Then call freescale_i2c_init(...) I see a macro for creating the bus, but it
has to pass some function pointers. I assume there is some code for that, or I
have to know all the magic things to put in the macro.

Once there is a device, it is not clear if the standard API can use it. And if
it can, I am not certain if it would behave any different that the Freescale
specific API commands.

So I think I mainly need to know how to get things glued together and
relationship between the generic vs Freescale API.

I don't need to know how to use the API to send and receive data.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (40 preceding siblings ...)
  2013-01-02  7:07 ` bugzilla-daemon
@ 2013-01-03  9:09 ` bugzilla-daemon
  2013-01-03  9:12 ` bugzilla-daemon
                   ` (41 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-01-03  9:09 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #36 from Tomas Frydrych <tf+bugs.ecos@r-finger.com> 2013-01-03 09:09:27 GMT ---
(In reply to comment #33)
> If you are too busy, and if you don't have objections, I would like to take
> care of the spin optimization (ref. comment 32), of course with all respect and
> credit to your contribution.

Please do with it whatever you deem needs doing :)

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (41 preceding siblings ...)
  2013-01-03  9:09 ` bugzilla-daemon
@ 2013-01-03  9:12 ` bugzilla-daemon
  2013-01-03 16:27 ` bugzilla-daemon
                   ` (40 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-01-03  9:12 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #37 from Tomas Frydrych <tf+bugs.ecos@r-finger.com> 2013-01-03 09:12:05 GMT ---
(In reply to comment #34)
> Can some one provide some simple code examples? 

The only example I have is the accelerometer driver, which is in the patches
attached to bug 1001419.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (42 preceding siblings ...)
  2013-01-03  9:12 ` bugzilla-daemon
@ 2013-01-03 16:27 ` bugzilla-daemon
  2013-01-06  5:47 ` bugzilla-daemon
                   ` (39 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-01-03 16:27 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #38 from Ilija Kocho <ilijak@siva.com.mk> 2013-01-03 16:27:42 GMT ---
Created an attachment (id=2017)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=2017)
Freescale I2C driver 130103, incremental to attachments 2004/2005

(In reply to comment #36)
> (In reply to comment #33)
> > If you are too busy, and if you don't have objections, I would like to take
> > care of the spin optimization (ref. comment 32), of course with all respect and
> > credit to your contribution.
> 
> Please do with it whatever you deem needs doing :)

Thank you. Here I propose a code that:
   - decreases i2c thread priority prior to wait spin;
   - returns after timeout (as Mike suggests)

The patch is incremental. Apply it on top of attachment 2004 and attachment
2005.

Ilija


Note: I haven't been able to test it with multiple i2c masters.

Ilija

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (43 preceding siblings ...)
  2013-01-03 16:27 ` bugzilla-daemon
@ 2013-01-06  5:47 ` bugzilla-daemon
  2013-03-02 18:08 ` bugzilla-daemon
                   ` (38 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-01-06  5:47 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #39 from Mike Jones <mjones@linear.com> 2013-01-06 05:46:55 GMT ---
I am having trouble slowing down the bus speed.

This is my code for write byte, but it is clocking at over 1Mhz, and my devices
only go up to 400Khz.

Is there something else I need to do?

void smbus_write_byte(uint8_t address, uint8_t command, uint8_t data)
{
    cyg_uint8 buffer[2];
    cyg_i2c_device device = {                        \
            .i2c_bus        = &hal_kinetis_i2c0_bus, \
            .i2c_address    = address,               \
            .i2c_flags      = 0,                     \
            .i2c_delay      = 10000                  \
        };

    buffer[0] = command;
    buffer[1] = data;

    cyg_i2c_transaction_begin(&device);
    if(!cyg_i2c_transaction_tx(&device, true, &buffer[0], 2, false)) {
        diag_printf("Read: fail TX.\n");
    }

    cyg_i2c_transaction_stop(&device);
    cyg_i2c_transaction_end(&device);
}

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (44 preceding siblings ...)
  2013-01-06  5:47 ` bugzilla-daemon
@ 2013-03-02 18:08 ` bugzilla-daemon
  2013-03-02 18:09 ` bugzilla-daemon
                   ` (37 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-03-02 18:08 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #40 from Mike Jones <mjones@linear.com> ---
Created attachment 2112
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2112&action=edit
Control clock rate, fix race condition, bug fix

This patch contains new code for managing clock speed that was added by Ilija.
He can provide a ChangeLog for that if desired. I tested/modified his code and
fixed bugs. There was a race condition that caused the driver to lockup if bits
were not set/cleared at the right time, and a few other small things. I don't
remember the exact changes any more without a fresh diff against the original
patch, but I remember the 3 days on the bench with a scope hunting it down :-)
The original author can diff against this version if desired. The actual bug
fixes are just a few lines of critical code.

I have run this on three PMBus devices extensively including a several day 24
hour telemetry run, meaning constant traffic reading and writing. There were no
errors.

If anyone wants to do more testing, I suggest testing something faster than
PMBus which maxes out at 400Khz.

In the future this could be improved to add API to manage SMBus features such
as the timeout mechanism. I don't have time at the moment to do that.

I suggest the original author (or others( apply the patch and test their
existing application. If nobody has any problems, I feel this code is safe to
commit to CVS.

Some example code:


const cyg_uint32 i2c_bus_time = 10000;

    cyg_i2c_device device = {                        \
            .i2c_bus        = &cyg_i2c0_bus,         \
            .i2c_address    = address,               \
            .i2c_flags      = 0,                     \
            .i2c_delay      = i2c_bus_time           \
        };
    cyg_uint8 buffer[1];
    cyg_uint8 input[1];
    buffer[0] = command;

    cyg_i2c_transaction_begin(&device);
    if(!cyg_i2c_transaction_tx(&device, true, &buffer[0], 1, false)) {
        diag_printf("Read Byte: fail TX.\n");
    } else if(!cyg_i2c_transaction_rx(&device, true, &input[0], 1, true, true))
{
        diag_printf("Read Byte: fail RX.\n");
    }
    cyg_i2c_transaction_end(&device);

    return input[0];

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (45 preceding siblings ...)
  2013-03-02 18:08 ` bugzilla-daemon
@ 2013-03-02 18:09 ` bugzilla-daemon
  2013-04-10 20:34 ` bugzilla-daemon
                   ` (36 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-03-02 18:09 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #41 from Mike Jones <mjones@linear.com> ---
I failed state that my patch called Control clock rate, fix race condition, bug
fix is a patch against CVS, not a patch against a patch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (46 preceding siblings ...)
  2013-03-02 18:09 ` bugzilla-daemon
@ 2013-04-10 20:34 ` bugzilla-daemon
  2013-04-10 20:54 ` bugzilla-daemon
                   ` (35 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-10 20:34 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned@bugs.ecos.source |ilijak@siva.com.mk
                   |ware.org                    |

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (47 preceding siblings ...)
  2013-04-10 20:34 ` bugzilla-daemon
@ 2013-04-10 20:54 ` bugzilla-daemon
  2013-04-10 21:14 ` bugzilla-daemon
                   ` (34 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-10 20:54 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |1001816

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (48 preceding siblings ...)
  2013-04-10 20:54 ` bugzilla-daemon
@ 2013-04-10 21:14 ` bugzilla-daemon
  2013-04-10 21:15 ` bugzilla-daemon
                   ` (33 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-10 21:14 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2004|0                           |1
        is obsolete|                            |
   Attachment #2017|0                           |1
        is obsolete|                            |
   Attachment #2112|0                           |1
        is obsolete|                            |

--- Comment #42 from Ilija Kocho <ilijak@siva.com.mk> ---
Created attachment 2179
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2179&action=edit
I2C driver with removed HAL code 130410

Mike

Here is the driver with HAL executable code removed. Now all code is in driver
and HAL borrows only data (pins, clock, etc).

I reworked clock rate calculator so it now deals with period rather than
frequency. The reason is replacing some division with multiplication (in a
loop). Once being with with the clock, I implemented your idea about frequency
set-point as user convenience. So now CDL accepts Hz but everything else works
with ns (actually for increasing of accuracy with 1/100ns.

I also removed some warnings, by patching high level I2C driver, so please try
also bug 1001816.

In case you submit patches please put driver, HAL, etc. and especially ecos.db
in separate patches. It makes it easier for management. FYI, simultaneously
with submitting you can obsolete one or several old patches.

Ilija

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (49 preceding siblings ...)
  2013-04-10 21:14 ` bugzilla-daemon
@ 2013-04-10 21:15 ` bugzilla-daemon
  2013-04-10 21:16 ` bugzilla-daemon
                   ` (32 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-10 21:15 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2005|0                           |1
        is obsolete|                            |

--- Comment #43 from Ilija Kocho <ilijak@siva.com.mk> ---
Created attachment 2180
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2180&action=edit
Kinetis HAL with I2C definitions. 130410

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetic microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (50 preceding siblings ...)
  2013-04-10 21:15 ` bugzilla-daemon
@ 2013-04-10 21:16 ` bugzilla-daemon
  2013-04-10 21:17 ` [Bug 1001397] I2C driver for Kinetis microcontrollers bugzilla-daemon
                   ` (31 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-10 21:16 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2006|0                           |1
        is obsolete|                            |

--- Comment #44 from Ilija Kocho <ilijak@siva.com.mk> ---
Created attachment 2181
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2181&action=edit
Freescale I2C driver ecos.db patch 130410

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (51 preceding siblings ...)
  2013-04-10 21:16 ` bugzilla-daemon
@ 2013-04-10 21:17 ` bugzilla-daemon
  2013-04-11  1:20 ` bugzilla-daemon
                   ` (30 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-10 21:17 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|I2C driver for Kinetic      |I2C driver for Kinetis
                   |microcontrollers            |microcontrollers

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (52 preceding siblings ...)
  2013-04-10 21:17 ` [Bug 1001397] I2C driver for Kinetis microcontrollers bugzilla-daemon
@ 2013-04-11  1:20 ` bugzilla-daemon
  2013-04-11  1:25 ` bugzilla-daemon
                   ` (29 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-11  1:20 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #45 from Mike Jones <mjones@linear.com> ---
I applied these three patches along with the 1001816. My application works as
before. I tested three periods: 10000, 2500, 3000. The clock period is longer
than the period by 6% to 10%. However, I have not checked it closely before, so
it could have been that way before. My checking was done on the Tower K60 using
three PMBus devices that read/write the device on a regular timer. I use this
every day, so if I don't say anything, I am not having problems.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (53 preceding siblings ...)
  2013-04-11  1:20 ` bugzilla-daemon
@ 2013-04-11  1:25 ` bugzilla-daemon
  2013-04-11  1:49 ` bugzilla-daemon
                   ` (28 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-11  1:25 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #46 from Mike Jones <mjones@linear.com> ---
Oops, I have to retract. I just noticed my symbolic link pointed to the wrong
tree. Will get back.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (54 preceding siblings ...)
  2013-04-11  1:25 ` bugzilla-daemon
@ 2013-04-11  1:49 ` bugzilla-daemon
  2013-04-13 23:21 ` bugzilla-daemon
                   ` (27 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-11  1:49 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #47 from Mike Jones <mjones@linear.com> ---
Created attachment 2182
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2182&action=edit
Lock up from I2C

Sadly, now that I have the correct symbolic link to the newly patched tree, the
code locks up on a condition as shown in the jpg. This occurs on the first
write transaction. The scope was set on single shot and there are no clocks, as
one would expect.

I apologize for the mistake. I should have suspected something when I imported
my ecm and it did not complain about the change in the CDL from period to
frequency.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (55 preceding siblings ...)
  2013-04-11  1:49 ` bugzilla-daemon
@ 2013-04-13 23:21 ` bugzilla-daemon
  2013-04-13 23:22 ` bugzilla-daemon
                   ` (26 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-13 23:21 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2179|0                           |1
        is obsolete|                            |
   Attachment #2182|0                           |1
        is obsolete|                            |

--- Comment #48 from Ilija Kocho <ilijak@siva.com.mk> ---
Created attachment 2183
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2183&action=edit
I2C driver 130414

Mike

I had assigned wrong pins for K60, no wonder why there's no clock.
Now I have corrected them and I hope now it will work. I am on a trip so my
testing ability is limited.

You will notice some additions in the CDL. Since more than one frequency
divider register setting may fit requested frequency, I added an option to
choose a fit.

You will find some other CDLs such as C2 register options, Glitch and SMB but
they are not active in code. I guess SMB shall need considerable work and you
can do better about SMB than me. But let's leave it off for the time being. We
may remove SMB option for first release.

Subsequent to this patch, I am posing another, HAL with corrected pin settings.

Ilija

(In reply to comment #47)
> Created attachment 2182 [details]
> Lock up from I2C
> 
> Sadly, now that I have the correct symbolic link to the newly patched tree,
> the code locks up on a condition as shown in the jpg. This occurs on the
> first write transaction. The scope was set on single shot and there are no
> clocks, as one would expect.
> 
> I apologize for the mistake. I should have suspected something when I
> imported my ecm and it did not complain about the change in the CDL from
> period to frequency.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (56 preceding siblings ...)
  2013-04-13 23:21 ` bugzilla-daemon
@ 2013-04-13 23:22 ` bugzilla-daemon
  2013-04-15 16:34 ` bugzilla-daemon
                   ` (25 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-13 23:22 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2180|0                           |1
        is obsolete|                            |

--- Comment #49 from Ilija Kocho <ilijak@siva.com.mk> ---
Created attachment 2184
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2184&action=edit
Kinetis HAL with I2C definitions. 130414

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (57 preceding siblings ...)
  2013-04-13 23:22 ` bugzilla-daemon
@ 2013-04-15 16:34 ` bugzilla-daemon
  2013-04-17 16:28 ` bugzilla-daemon
                   ` (24 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-15 16:34 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #50 from Mike Jones <mjones@linear.com> ---
I have these patches applied and working. I'll keep testing over the next few
days.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (58 preceding siblings ...)
  2013-04-15 16:34 ` bugzilla-daemon
@ 2013-04-17 16:28 ` bugzilla-daemon
  2013-04-17 17:43 ` bugzilla-daemon
                   ` (23 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-17 16:28 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #51 from Mike Jones <mjones@linear.com> ---
I tested the patches at different frequencies using code like this:


    cyg_i2c_device device = {                        \
            .i2c_bus        = &cyg_i2c0_bus,         \
            .i2c_address    = 0x0C,                   \
            .i2c_flags      = 0,                     \
            .i2c_delay      = i2c_bus_time           \
        };

It works at 100/400Khz properly. The there is more error in the frequency than
some end users will want.  It seems to run about 10% too slow.

In the CDL "SMB register options" is misspelled. register is missing an r.

I don't have means at the moment to test SMB options. I suggest this is tested
after releasing this code. When the STM32 I2C is in a similar state to this
code, I can build hardware that supports built in ALERTB processing for both
processors and test the SMB support. The current patches seem adequate for I2C
and work fine with my large application.

I would like to test default clock speed, meaning the frequency in the CDL. How
do I write code that uses the default rather than .i2c_delay. Yes, I am being
lazy and not digging into the code.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (59 preceding siblings ...)
  2013-04-17 16:28 ` bugzilla-daemon
@ 2013-04-17 17:43 ` bugzilla-daemon
  2013-04-19 16:39 ` bugzilla-daemon
                   ` (22 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-17 17:43 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #52 from Ilija Kocho <ilijak@siva.com.mk> ---
Created attachment 2185
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2185&action=edit
Best fit aggressive clocking (incremantal).

(In reply to comment #51)
> I tested the patches at different frequencies using code like this:
> 
> 
>     cyg_i2c_device device = {                        \
>             .i2c_bus        = &cyg_i2c0_bus,		 \
>             .i2c_address    = 0x0C,               	\
>             .i2c_flags      = 0,                     \
>             .i2c_delay      = i2c_bus_time           \
>         };
> 
> It works at 100/400Khz properly. The there is more error in the frequency
> than some end users will want.  It seems to run about 10% too slow.

The frequency divider calculator is conservative, if exact frequency is not
available, it will pick the previous (lower) frequency. Since there are more
such combinations, in the CDL you can select up to which FIT to look, (takes
more time). It will still be lower or equal, but may be closer. If it is
permissible, here is a (non tested) incremental patch with somewhat aggressive
approach, it will pick the closest frequency even if it overclocks. We can give
user a chance to (dis)allow aggressive clocking by means of CDL.

Please advise.

> 
> In the CDL "SMB register options" is misspelled. register is missing an r.
> 
Thanks, I'll fix.


> I don't have means at the moment to test SMB options. I suggest this is
> tested after releasing this code. When the STM32 I2C is in a similar state
> to this code, I can build hardware that supports built in ALERTB processing
> for both processors and test the SMB support. The current patches seem
> adequate for I2C and work fine with my large application.

I agree, then I would remove SMB CDL from current release since it may be
misleading.

> 
> I would like to test default clock speed, meaning the frequency in the CDL.
> How do I write code that uses the default rather than .i2c_delay. Yes, I am
> being lazy and not digging into the code.

I don't think that there's such option, I guess the idea is that every device
on the bus has it's own clocking requirement. Frankly I don't know what is it
for.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (60 preceding siblings ...)
  2013-04-17 17:43 ` bugzilla-daemon
@ 2013-04-19 16:39 ` bugzilla-daemon
  2013-04-20 20:09 ` bugzilla-daemon
                   ` (21 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-19 16:39 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #53 from Mike Jones <mjones@linear.com> ---
Ilija,

I have been thinking about aggressive vs. conservative clock calculation, and
the SMB support for ALERTB.

I think in the short run it probably makes sense to release with conservative
clocking and no SMB support. Get the STM32 I2C and the Kinetis I2C at the same
level of stability. This will allow application writers to cover 80% of their
needs.

We can then add SMB support and incremental improvements later, perhaps
releasing STM32 and Kinetis at the same time. This will give us some room to
experiment with SMB support and give me time to develop testing support and
example code. I may want to add SMB API at the same time, which is a higher
level API wrapped around the I2C API. I already have code for this, but I have
to get permission to contribute it and there has to be a strategy of how to
integrate it.

So on this thinking, you could release this as is without the aggressive
clocking, minus the SMB CDL settings. Just leave the basic SMB register support
in the code so it can be experimented with.

Mike

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (61 preceding siblings ...)
  2013-04-19 16:39 ` bugzilla-daemon
@ 2013-04-20 20:09 ` bugzilla-daemon
  2013-04-21  7:47 ` bugzilla-daemon
                   ` (20 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-20 20:09 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2183|0                           |1
        is obsolete|                            |
   Attachment #2185|0                           |1
        is obsolete|                            |

--- Comment #54 from Ilija Kocho <ilijak@siva.com.mk> ---
Created attachment 2188
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2188&action=edit
I2C driver 130420

Mike

Summing up our discussion here I attach the driver with following updates:

    - Aggressive clocking is implemented and configurable by:
       - CDL (for default setting)
       - Macro FREESCALE_I2C_DELAY_CFG(delay, fit, agr) - for individual
devices

    - SMB has been removed for the time being

Examples for FREESCALE_I2C_DELAY_CFG:

Following device will look aggressively for 200kHz (5000 [ns])

CYG_I2C_DEVICE(i2c_dev,
               &cyg_i2c0_bus,
               0x4cu,
               0,
               FREESCALE_I2C_DELAY_CFG(5000, 0, 1)
);

Following device will look conservatively for 100kHz (10000 [ns])

CYG_I2C_DEVICE(i2c_dev,
               &cyg_i2c0_bus,
               0x4cu,
               0,
               FREESCALE_I2C_DELAY_CFG(10000, 0, 0)
);

Which is equivalent to:

CYG_I2C_DEVICE(i2c_dev,
               &cyg_i2c0_bus,
               0x4cu,
               0,
               10000
);

(In reply to comment #52)

> > I would like to test default clock speed, meaning the frequency in the CDL.
> > How do I write code that uses the default rather than .i2c_delay. Yes, I am
> > being lazy and not digging into the code.

I took care of this
Now if you enter 0 for delay, the device shall use default value.

Example:

Following device will look conservatively for 100kHz (10000 [ns])

CYG_I2C_DEVICE(i2c_dev,
               &cyg_i2c0_bus,
               0x4cu,
               0,
               0
);

Please test this and if you are happy I think I could commit.

Ilija

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (62 preceding siblings ...)
  2013-04-20 20:09 ` bugzilla-daemon
@ 2013-04-21  7:47 ` bugzilla-daemon
  2013-04-21 14:09 ` bugzilla-daemon
                   ` (19 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-21  7:47 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #55 from Ilija Kocho <ilijak@siva.com.mk> ---
(In reply to comment #51)

> It works at 100/400Khz properly. The there is more error in the frequency
> than some end users will want.  It seems to run about 10% too slow.

For these particular set-point frequencies you will get better fit if you set
the system frequency to 100MHz. As a side effect you also get slightly faster
system.
Default frequency is 96MHz was selected in order to derive 48Mhz for USB.
Perhaps we should change it to 100Mhz. We don't have USB driver yet and once we
have we can set it to 48Nhz selectively.

Ilija

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (63 preceding siblings ...)
  2013-04-21  7:47 ` bugzilla-daemon
@ 2013-04-21 14:09 ` bugzilla-daemon
  2013-04-23  4:47 ` bugzilla-daemon
                   ` (18 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-21 14:09 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #56 from Mike Jones <mjones@linear.com> ---
I don't feel very strongly about defaults for I2C vs. USB. I am ok with 48Mhz
with a lenient vs aggressive selection. However, it will help the end user is
the final version has a note in the CDL description explaining how to get
exactly 100/400Khz by changing the clock.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (64 preceding siblings ...)
  2013-04-21 14:09 ` bugzilla-daemon
@ 2013-04-23  4:47 ` bugzilla-daemon
  2013-04-23  7:01 ` bugzilla-daemon
                   ` (17 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-23  4:47 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #57 from Mike Jones <mjones@linear.com> ---
I get the same conservative frequency no matter how
CYGNUM_DEVS_FREESCALE_I2C_CLOCK_AGR is set.

I have given the code below, which I know ignores the delay specified in the
CDL. Is there a different way to write the code so that the delay and AGR of
the CDL get applied?

uint16_t smbus_read_word(uint8_t address, uint8_t command)
{
    cyg_i2c_device device = {                        \
            .i2c_bus        = &cyg_i2c0_bus,         \
            .i2c_address    = address,               \
            .i2c_flags      = 0,                     \
            .i2c_delay      = i2c_bus_time           \
        };
    cyg_uint8 buffer[1];
    cyg_uint8 input[2];
    buffer[0] = command;

    cyg_i2c_transaction_begin(&device);
    if(!cyg_i2c_transaction_tx(&device, true, &buffer[0], 1, false)) {
        diag_printf("Read Word: fail TX.\n");
    } else if(!cyg_i2c_transaction_rx(&device, true, &input[0], 2, true, true))
{
        diag_printf("Read Word: fail RX.\n");
    }
    cyg_i2c_transaction_end(&device);

    return input[1] << 8 | input[0];
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (65 preceding siblings ...)
  2013-04-23  4:47 ` bugzilla-daemon
@ 2013-04-23  7:01 ` bugzilla-daemon
  2013-04-24  6:56 ` bugzilla-daemon
                   ` (16 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-23  7:01 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #58 from Ilija Kocho <ilijak@siva.com.mk> ---
(In reply to comment #57)
> I get the same conservative frequency no matter how
> CYGNUM_DEVS_FREESCALE_I2C_CLOCK_AGR is set.

That means that it is the closest frequency to the set-point (i.e. the closest
higher frequency would give larger error). The frequency selection is rather
coarse so there's little help, given the system clock frequency. By
experimenting I have noticed that if system clock is 100MHz (rather than
current 96MHz) we get better match for 100Khz (and 400Khz). Also with inf that
case the aggressive lookup gives closer (upper) match than conservative.

> 
> I have given the code below, which I know ignores the delay specified in the
> CDL. Is there a different way to write the code so that the delay and AGR of
> the CDL get applied?

Just set i2c_delay (i.e. i2c_bus_time) to 0. Instead of infinite frequency it
will give you the default one.

For example:
     cyg_i2c_device device = {
             .i2c_bus        = &cyg_i2c0_bus,
             .i2c_address    = address,
             .i2c_flags      = 0,
             .i2c_delay      = 0
         };

See other examples for enforcing FIT and aggressive lookup in comment 54.

Some [off topic] remarks to the code below:
device is automatic variable that means it's being initialized every time the
function is called. It's very inefficient. Setting i2c_delay =  0 shall make
initialization far much efficient since the  clock lookup once executed during
initialization of the I2C bus, in subsequent calls will use cached F register
setting. However the code is still less efficient than what's possible, because
the device structure ans device itself shall be initialized on every function
call. The better way is to declare device as static variable (spend little-bit
memory but save little-bit stack and little-bit more CPU time). However, I can
imagine that you use the same (hardware) device from other functions. If it is
true, than device should be a global variable.

> 
> uint16_t smbus_read_word(uint8_t address, uint8_t command)
> {
>     cyg_i2c_device device = {                        \
>             .i2c_bus        = &cyg_i2c0_bus,	     \
>             .i2c_address    = address,               \
>             .i2c_flags      = 0,                     \
>             .i2c_delay      = i2c_bus_time           \
>         };
>     cyg_uint8 buffer[1];
>     cyg_uint8 input[2];
>     buffer[0] = command;
> 
>     cyg_i2c_transaction_begin(&device);
> 	if(!cyg_i2c_transaction_tx(&device, true, &buffer[0], 1, false)) {
>         diag_printf("Read Word: fail TX.\n");
> 	} else if(!cyg_i2c_transaction_rx(&device, true, &input[0], 2, true, true))
> {
>         diag_printf("Read Word: fail RX.\n");
>     }
>     cyg_i2c_transaction_end(&device);
> 
>     return input[1] << 8 | input[0];
> }

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (66 preceding siblings ...)
  2013-04-23  7:01 ` bugzilla-daemon
@ 2013-04-24  6:56 ` bugzilla-daemon
  2013-04-24  9:08 ` bugzilla-daemon
                   ` (15 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-24  6:56 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #59 from Mike Jones <mjones@linear.com> ---
After setting CPU clock to 100Khz:

Freq        Mode         Meas
100Khz      Std          98Khz
100Khz      Agr          111Khz
400Khz      Std          363Khz
400Khz      Agr          416Khz

From an application point of view, this is a little problematic, in that:

- When you set the goal and value, you don't get feedback in the configuration
that tells you what the result will be. You have to get a scope and measure it.

- If you want to make it more accurate, you have to either guess the correct
CPU clock, or reverse engineer the algorithm to calculate the required clock
manually.

One solution might be to have the configuration calculate the proper CPU clock
so you can then manually change the clock to get a better result. 

I am ok with committing the solution as is because I can figure it out for 100
and 400 and will have the only answers I need. I think it is just a question of
how much you want to help the application programmer.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (67 preceding siblings ...)
  2013-04-24  6:56 ` bugzilla-daemon
@ 2013-04-24  9:08 ` bugzilla-daemon
  2013-04-24 17:20 ` bugzilla-daemon
                   ` (14 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-24  9:08 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #60 from Ilija Kocho <ilijak@siva.com.mk> ---
Created attachment 2206
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2206&action=edit
I2C driver print out actual frequency when trace enabled. Increment to
attachment 2188.

Mike

(In reply to comment #59)
> After setting CPU clock to 100Khz:
> 
> Freq        Mode         Meas
> 100Khz      Std          98Khz
> 100Khz      Agr          111Khz
> 400Khz      Std          363Khz
> 400Khz      Agr          416Khz

Thank you for the measurements.

> 
> From an application point of view, this is a little problematic, in that:
> 
> - When you set the goal and value, you don't get feedback in the
> configuration that tells you what the result will be. You have to get a
> scope and measure it.
> 
> - If you want to make it more accurate, you have to either guess the correct
> CPU clock, or reverse engineer the algorithm to calculate the required clock
> manually.
> 
> One solution might be to have the configuration calculate the proper CPU
> clock so you can then manually change the clock to get a better result. 
> 

It would be good to have this convenience in CDL but it requires some Tcl
programming, which requires some time...

The second best is to enable some printout at run-time. The attached
incremental patch enables printout of actual I2C clock frequency and period
when trace is enabled.

Note: The printouts that I got are pretty close to what you have measured for
100kHz, but there is a large discrepancy for 400kHz. Can you please and repeat
measurements and check the printouts?

> I am ok with committing the solution as is because I can figure it out for
> 100 and 400 and will have the only answers I need. I think it is just a
> question of how much you want to help the application programmer.

If you are happy with proposed patch and there aren't objections, I would
proceed with commit.

Ilija

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (68 preceding siblings ...)
  2013-04-24  9:08 ` bugzilla-daemon
@ 2013-04-24 17:20 ` bugzilla-daemon
  2013-04-24 18:46 ` bugzilla-daemon
                   ` (13 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-24 17:20 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #61 from Mike Jones <mjones@linear.com> ---
I remeasured the 400Khz numbers and then put the printed calcs in the table.

The 400Khz measurements were the same as before.


Freq        Mode         Meas        Calc
100Khz      Std          98Khz       97Khz
100Khz      Agr          111Khz      111Khz
400Khz      Std          363Khz      390Khz
400Khz      Agr          416Khz      446Khz

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (69 preceding siblings ...)
  2013-04-24 17:20 ` bugzilla-daemon
@ 2013-04-24 18:46 ` bugzilla-daemon
  2013-04-25 17:06 ` bugzilla-daemon
                   ` (12 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-24 18:46 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #62 from Ilija Kocho <ilijak@siva.com.mk> ---
Created attachment 2209
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2209&action=edit
I2C driver Frequency divider table fix 130424 incremantal to att 2188

(In reply to comment #61)
> I remeasured the 400Khz numbers and then put the printed calcs in the table.
> 
> The 400Khz measurements were the same as before.
> 
> 
> Freq        Mode         Meas        Calc
> 100Khz      Std          98Khz       97Khz
> 100Khz      Agr          111Khz      111Khz
> 400Khz      Std          363Khz      390Khz
> 400Khz      Agr          416Khz      446Khz

It seems that there's discrepancy in I2C doc for frequency divider table. I did
some fixes to match your measurements. 400kHz Agr is pretty close to your scope
416666 Hz. Std is pretty close, but not so much 367647 Hz.
Here's an incremental patch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (70 preceding siblings ...)
  2013-04-24 18:46 ` bugzilla-daemon
@ 2013-04-25 17:06 ` bugzilla-daemon
  2013-04-26 12:54 ` bugzilla-daemon
                   ` (11 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-25 17:06 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2209|0                           |1
        is obsolete|                            |

--- Comment #63 from Ilija Kocho <ilijak@siva.com.mk> ---
Created attachment 2212
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2212&action=edit
I2C driver Frequency divider table fix 130425 incremantal to att 2188

Here I attach a clean-up for attachment 2209.
If there aren't objections for this or for (blocker) bug 1001816 I plan to
commit tomorrow Apr.26.2013.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (71 preceding siblings ...)
  2013-04-25 17:06 ` bugzilla-daemon
@ 2013-04-26 12:54 ` bugzilla-daemon
  2013-04-26 13:39 ` bugzilla-daemon
                   ` (10 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-26 12:54 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2206|0                           |1
        is obsolete|                            |

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (72 preceding siblings ...)
  2013-04-26 12:54 ` bugzilla-daemon
@ 2013-04-26 13:39 ` bugzilla-daemon
  2013-04-26 17:13 ` bugzilla-daemon
                   ` (9 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-26 13:39 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2206|1                           |0
        is obsolete|                            |

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (73 preceding siblings ...)
  2013-04-26 13:39 ` bugzilla-daemon
@ 2013-04-26 17:13 ` bugzilla-daemon
  2013-04-26 17:17 ` bugzilla-daemon
                   ` (8 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-26 17:13 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Bug 1001397 depends on bug 1001816, which changed state.

Bug 1001816 Summary: Allow non const cyg_i2c_device for I2C callback functions.
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001816

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |CURRENTRELEASE

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (74 preceding siblings ...)
  2013-04-26 17:13 ` bugzilla-daemon
@ 2013-04-26 17:17 ` bugzilla-daemon
  2013-04-30 11:40 ` bugzilla-daemon
                   ` (7 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-26 17:17 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #64 from Ilija Kocho <ilijak@siva.com.mk> ---
Checked in.

Thanks to Tomas and Mike for contribution and fine work.

Ilija

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (75 preceding siblings ...)
  2013-04-26 17:17 ` bugzilla-daemon
@ 2013-04-30 11:40 ` bugzilla-daemon
  2013-04-30 11:40 ` bugzilla-daemon
                   ` (6 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-30 11:40 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #65 from Ilija Kocho <ilijak@siva.com.mk> ---
Created attachment 2218
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2218&action=edit
Require CYGPKG_KERNEL

There is a problem with build of RedBoot. i2c_freescale.c looks for kapi.h that
is not present in RB configuration. Compilation breaks.

The attached patch deactivates Freescale I2C driver when CYGPKG_KERNEL is not
present. It shouldn't be additional limitation for RedBoot since driver doesn't
support polled operation anyway.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (76 preceding siblings ...)
  2013-04-30 11:40 ` bugzilla-daemon
@ 2013-04-30 11:40 ` bugzilla-daemon
  2013-04-30 19:03 ` bugzilla-daemon
                   ` (5 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-30 11:40 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2218|0                           |1
           is patch|                            |

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (77 preceding siblings ...)
  2013-04-30 11:40 ` bugzilla-daemon
@ 2013-04-30 19:03 ` bugzilla-daemon
  2013-08-29 17:58 ` bugzilla-daemon
                   ` (4 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-04-30 19:03 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |CURRENTRELEASE

--- Comment #66 from Ilija Kocho <ilijak@siva.com.mk> ---
Checked in attachment 2218.
Closing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (78 preceding siblings ...)
  2013-04-30 19:03 ` bugzilla-daemon
@ 2013-08-29 17:58 ` bugzilla-daemon
  2013-08-29 18:00 ` bugzilla-daemon
                   ` (3 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-08-29 17:58 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #67 from Stefan Singer <Stefan.Singer@freescale.com> ---
Created attachment 2350
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2350&action=edit
support for additional architectures

Patch to support other architectures, Freescale MPC5xxx and Freescale Vybrid

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (79 preceding siblings ...)
  2013-08-29 17:58 ` bugzilla-daemon
@ 2013-08-29 18:00 ` bugzilla-daemon
  2013-08-30  7:15 ` bugzilla-daemon
                   ` (2 subsequent siblings)
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-08-29 18:00 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Stefan Singer <Stefan.Singer@freescale.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Stefan.Singer@freescale.com

--- Comment #68 from Stefan Singer <Stefan.Singer@freescale.com> ---
Hi guys,
some very minor patch to enable support for two other architectures (Freescale
MPC5xxx and Vybrid). This also includes a special treatment of the module
enable bit, which differs between those architectures.

Stefan

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (80 preceding siblings ...)
  2013-08-29 18:00 ` bugzilla-daemon
@ 2013-08-30  7:15 ` bugzilla-daemon
  2013-08-30  7:18 ` bugzilla-daemon
  2014-01-28  1:46 ` bugzilla-daemon
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-08-30  7:15 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

--- Comment #69 from Ilija Kocho [Илија Кочо] <ilijak@siva.com.mk> ---
(In reply to comment #68)

Stefan,

Thank you for the patch. I am ready to commit, however I have some minor
remarks:

Would be good to define a macro (mask) for MDIS (as well as for some other bits
found on other platforms, if any)?
Than you can use this mnemonic at: / i2c_s->c1 &= 0x7F; /

Please note that empty lines are part of ChangeLog format. Here's a brief
description
http://www.gnu.org/software/emacs/manual/html_node/emacs/Format-of-ChangeLog.html

Could you post an update?

Ilija

> Hi guys,
> some very minor patch to enable support for two other architectures
> (Freescale MPC5xxx and Vybrid). This also includes a special treatment of
> the module enable bit, which differs between those architectures.
> 
> Stefan

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (81 preceding siblings ...)
  2013-08-30  7:15 ` bugzilla-daemon
@ 2013-08-30  7:18 ` bugzilla-daemon
  2014-01-28  1:46 ` bugzilla-daemon
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2013-08-30  7:18 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho [Илија Кочо] <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|CURRENTRELEASE              |---

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

* [Bug 1001397] I2C driver for Kinetis microcontrollers
       [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
                   ` (82 preceding siblings ...)
  2013-08-30  7:18 ` bugzilla-daemon
@ 2014-01-28  1:46 ` bugzilla-daemon
  83 siblings, 0 replies; 84+ messages in thread
From: bugzilla-daemon @ 2014-01-28  1:46 UTC (permalink / raw)
  To: ecos-patches

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001397

Ilija Kocho [Илија Кочо] <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |1001933

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 84+ messages in thread

end of thread, other threads:[~2014-01-28  1:46 UTC | newest]

Thread overview: 84+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-1001397-104@http.bugs.ecos.sourceware.org/>
2011-12-01 15:48 ` [Bug 1001397] I2C driver for Kinetic microcontrollers bugzilla-daemon
2011-12-01 15:52 ` bugzilla-daemon
2011-12-01 15:58 ` bugzilla-daemon
2011-12-13 15:13 ` bugzilla-daemon
2011-12-23 10:41 ` bugzilla-daemon
2011-12-23 13:28 ` bugzilla-daemon
2011-12-23 14:14 ` bugzilla-daemon
2011-12-23 14:15 ` bugzilla-daemon
2011-12-24  9:22 ` bugzilla-daemon
2011-12-24 11:59 ` bugzilla-daemon
2011-12-26  7:32 ` bugzilla-daemon
2012-01-01 21:13 ` bugzilla-daemon
2012-01-10 15:40 ` bugzilla-daemon
2012-01-11 20:33 ` bugzilla-daemon
2012-01-16 14:31 ` bugzilla-daemon
2012-02-07 20:38 ` bugzilla-daemon
2012-02-08  9:12 ` bugzilla-daemon
2012-02-08  9:55 ` bugzilla-daemon
2012-02-11  0:16 ` bugzilla-daemon
2012-02-11 10:14 ` bugzilla-daemon
2012-02-12 19:11 ` bugzilla-daemon
2012-02-12 19:11 ` bugzilla-daemon
2012-02-23 16:11 ` bugzilla-daemon
2012-03-20 15:17 ` bugzilla-daemon
2012-03-31 17:17 ` bugzilla-daemon
2012-05-04 18:17 ` bugzilla-daemon
2012-12-21 20:46 ` bugzilla-daemon
2012-12-24  9:52 ` bugzilla-daemon
2012-12-24 16:53 ` bugzilla-daemon
2012-12-24 16:54 ` bugzilla-daemon
2012-12-24 16:56 ` bugzilla-daemon
2012-12-24 16:56 ` bugzilla-daemon
2012-12-24 17:14 ` bugzilla-daemon
2012-12-24 17:38 ` bugzilla-daemon
2012-12-25 21:32 ` bugzilla-daemon
2012-12-25 21:33 ` bugzilla-daemon
2012-12-25 23:38 ` bugzilla-daemon
2012-12-26 15:06 ` bugzilla-daemon
2012-12-29 14:24 ` bugzilla-daemon
2013-01-02  3:48 ` bugzilla-daemon
2013-01-02  7:07 ` bugzilla-daemon
2013-01-03  9:09 ` bugzilla-daemon
2013-01-03  9:12 ` bugzilla-daemon
2013-01-03 16:27 ` bugzilla-daemon
2013-01-06  5:47 ` bugzilla-daemon
2013-03-02 18:08 ` bugzilla-daemon
2013-03-02 18:09 ` bugzilla-daemon
2013-04-10 20:34 ` bugzilla-daemon
2013-04-10 20:54 ` bugzilla-daemon
2013-04-10 21:14 ` bugzilla-daemon
2013-04-10 21:15 ` bugzilla-daemon
2013-04-10 21:16 ` bugzilla-daemon
2013-04-10 21:17 ` [Bug 1001397] I2C driver for Kinetis microcontrollers bugzilla-daemon
2013-04-11  1:20 ` bugzilla-daemon
2013-04-11  1:25 ` bugzilla-daemon
2013-04-11  1:49 ` bugzilla-daemon
2013-04-13 23:21 ` bugzilla-daemon
2013-04-13 23:22 ` bugzilla-daemon
2013-04-15 16:34 ` bugzilla-daemon
2013-04-17 16:28 ` bugzilla-daemon
2013-04-17 17:43 ` bugzilla-daemon
2013-04-19 16:39 ` bugzilla-daemon
2013-04-20 20:09 ` bugzilla-daemon
2013-04-21  7:47 ` bugzilla-daemon
2013-04-21 14:09 ` bugzilla-daemon
2013-04-23  4:47 ` bugzilla-daemon
2013-04-23  7:01 ` bugzilla-daemon
2013-04-24  6:56 ` bugzilla-daemon
2013-04-24  9:08 ` bugzilla-daemon
2013-04-24 17:20 ` bugzilla-daemon
2013-04-24 18:46 ` bugzilla-daemon
2013-04-25 17:06 ` bugzilla-daemon
2013-04-26 12:54 ` bugzilla-daemon
2013-04-26 13:39 ` bugzilla-daemon
2013-04-26 17:13 ` bugzilla-daemon
2013-04-26 17:17 ` bugzilla-daemon
2013-04-30 11:40 ` bugzilla-daemon
2013-04-30 11:40 ` bugzilla-daemon
2013-04-30 19:03 ` bugzilla-daemon
2013-08-29 17:58 ` bugzilla-daemon
2013-08-29 18:00 ` bugzilla-daemon
2013-08-30  7:15 ` bugzilla-daemon
2013-08-30  7:18 ` bugzilla-daemon
2014-01-28  1:46 ` bugzilla-daemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).