Skip to content

Update i2c1-bcm2708-overlay.dts - #2118

Closed
soodvarun78 wants to merge 1 commit into
raspberrypi:rpi-4.9.yfrom
soodvarun78:patch-1
Closed

soodvarun78 wants to merge 1 commit into
raspberrypi:rpi-4.9.yfrom
soodvarun78:patch-1

Conversation

@soodvarun78

Copy link
Copy Markdown

Removing fragment@1 as it is not required.
The fragment 1 creates another device node with name i2c1_pins which is already created by dts files bcm2710-rpi-3-b.dts, bcm2708-rpi-b-plus.dts and bcm2709-rpi-2-b.dts.

Removing fragment@1 as it is not required. 
The fragment creates another device node in the with name i2c1_pins, as already dts files bcm2710-rpi-3-b.dts, bcm2708-rpi-b-plus.dts and bcm2709-rpi-2-b.dts creates the device node.
@pelwell

pelwell commented Jul 17, 2017

Copy link
Copy Markdown
Contributor

Have you tested the modified overlay? Although you've spotted an undesirable anomaly, with your patch the overlay no longer applies.

There was a time, over a year ago, when the overlay was merged with the base tree before the parameters were applied, but that was changed so that parameters modify the overlay before merging with the base tree in order to fit with the way the kernel applied overlays. Although this sounds like an implementation detail, a consequence is that parameters/overrides can only refer to symbols within the overlay. The workaround is to create a fragment that targets the symbol and populate it with the properties that the parameters have to change (*).

A working version that removes the duplication looks like this:

/*
 * Device tree overlay for i2c_bcm2708, i2c1 bus
 *
 * Compile:
 * dtc -@ -I dts -O dtb -o i2c1-bcm2708-overlay.dtb i2c1-bcm2708-overlay.dts
 */

/dts-v1/;
/plugin/;

/{
   compatible = "brcm,bcm2708";

   fragment@0 {
      target = <&i2c1>;
      __overlay__ {
         pinctrl-0 = <&i2c1_pins>;
         status = "okay";
      };
   };

   fragment@1 {
      target = <&i2c1_pins>;
         pins: __overlay__ {
         brcm,pins = <2 3>;
         brcm,function = <4>; /* alt 0 */
      };
   };

   __overrides__ {
      sda1_pin = <&pins>,"brcm,pins:0";
      scl1_pin = <&pins>,"brcm,pins:4";
      pin_func = <&pins>,"brcm,function:0";
   };
};

(*) N.B. Although it is permissible for a parameter to create a property that doesn't exist, if the parameter is only modifying a part of the property then the remainder will be filled with zeroes to make it long enough (unless other parameters overwrite the rest), which probably isn't what you want. Therefore it is safer (but less flexible) to provide a default property value.

@yaode

yaode commented Jul 17, 2017 via email

Copy link
Copy Markdown

@pelwell

pelwell commented Jul 17, 2017

Copy link
Copy Markdown
Contributor

@soodvarun78

soodvarun78 commented Jul 17, 2017 •

Copy link
Copy Markdown
Author

Hi Phil ,

Thanks for the input.
Yes I have tested my commit. It was working.
The reason for commit , is that if we run the command
sudo dtoverlay i2c1-bcm2708
from command line , the probe function of i2c was failing because of an error generated in PinControl subsystem with dmesg 'invalid phandle'.
So I removed the fragment@1 and probe was successful for the reason I have mentioned in commit comment.

I verified your patch and it is working... It is much more cleaner than me.

Regards
Varun Sood

pelwell pushed a commit that referenced this pull request Jul 19, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
@pelwell

pelwell commented Jul 19, 2017

Copy link
Copy Markdown
Contributor

The modified patch is now in the 4.9 tree.

@pelwell pelwell closed this Jul 19, 2017
pelwell pushed a commit that referenced this pull request Jul 19, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
pelwell pushed a commit that referenced this pull request Jul 19, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
pelwell pushed a commit that referenced this pull request Jul 20, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Jul 21, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Jul 21, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Jul 21, 2017
kernel: config: enhance DualShock3 controller support
See: raspberrypi/linux#2121

kernel: bcm2835-mmc: Fix DMA usage
kernel: bcm2835-mmc: Prevent DMA race condition

kernel: overlays: i2c1-bcm2708: Don't overwrite i2c1 pins node
See: raspberrypi/linux#2118
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Jul 21, 2017
kernel: config: enhance DualShock3 controller support
See: raspberrypi/linux#2121

kernel: bcm2835-mmc: Fix DMA usage
kernel: bcm2835-mmc: Prevent DMA race condition

kernel: overlays: i2c1-bcm2708: Don't overwrite i2c1 pins node
See: raspberrypi/linux#2118
popcornmix pushed a commit that referenced this pull request Jul 27, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Jul 29, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Aug 1, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Aug 8, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Aug 8, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Aug 10, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Aug 13, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Aug 13, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Aug 14, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Aug 23, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Aug 23, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Aug 25, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Aug 30, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Sep 1, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Sep 4, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Sep 8, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Sep 13, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Sep 13, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Sep 14, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Sep 14, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Sep 22, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
popcornmix pushed a commit that referenced this pull request Oct 29, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: #2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
raspbian-autopush pushed a commit to raspbian-packages/linux-4.9 that referenced this pull request Nov 2, 2017
commit d33a484
Author: Phil Elwell <phil@raspberrypi.org>
Date:   Wed Jul 19 15:20:50 2017 +0100

    overlays: i2c1-bcm2708: Don't overwrite i2c1 pins node
    
    It is bad practise to overwrite an entire node in an overlay. Instead,
    target the node and overwrite any properties that need changing.
    
    See: raspberrypi/linux#2118
    
    Suggested-by: soodvarun78 <soodvarun78@gmail.com>
    Signed-off-by: Phil Elwell <phil@raspberrypi.org>


Gbp-Pq: Topic rpi
Gbp-Pq: Name rpi_1310_d33a484ffeda75e7f3bc76f9ebe1b384a71ec305.patch
ryncsn pushed a commit to ryncsn/linux-rasp that referenced this pull request Nov 21, 2017
It is bad practise to overwrite an entire node in an overlay. Instead,
target the node and overwrite any properties that need changing.

See: raspberrypi#2118

Suggested-by: soodvarun78 <soodvarun78@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
raspbian-autopush pushed a commit to raspbian-packages/linux-4.9 that referenced this pull request Apr 7, 2018
commit 2ad0bc7
Author: Phil Elwell <phil@raspberrypi.org>
Date:   Wed Jul 19 15:20:50 2017 +0100

    overlays: i2c1-bcm2708: Don't overwrite i2c1 pins node
    
    It is bad practise to overwrite an entire node in an overlay. Instead,
    target the node and overwrite any properties that need changing.
    
    See: raspberrypi/linux#2118
    
    Suggested-by: soodvarun78 <soodvarun78@gmail.com>
    Signed-off-by: Phil Elwell <phil@raspberrypi.org>


Gbp-Pq: Topic rpi
Gbp-Pq: Name rpi_1312_2ad0bc7fe2645a1a0c0f6e1034720c1d296c0e7e.patch
raspbian-autopush pushed a commit to raspbian-packages/linux-4.9 that referenced this pull request Nov 11, 2018
commit 2ad0bc7
Author: Phil Elwell <phil@raspberrypi.org>
Date:   Wed Jul 19 15:20:50 2017 +0100

    overlays: i2c1-bcm2708: Don't overwrite i2c1 pins node
    
    It is bad practise to overwrite an entire node in an overlay. Instead,
    target the node and overwrite any properties that need changing.
    
    See: raspberrypi/linux#2118
    
    Suggested-by: soodvarun78 <soodvarun78@gmail.com>
    Signed-off-by: Phil Elwell <phil@raspberrypi.org>


Gbp-Pq: Topic rpi
Gbp-Pq: Name rpi_1312_2ad0bc7fe2645a1a0c0f6e1034720c1d296c0e7e.patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants