Skip to content

Instantly share code, notes, and snippets.

@RobertCNelson
Created October 26, 2018 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobertCNelson/507ec93db7d1b8041810cc070c0d894e to your computer and use it in GitHub Desktop.
Save RobertCNelson/507ec93db7d1b8041810cc070c0d894e to your computer and use it in GitHub Desktop.
/*
* Copyright (C) 2018 Me
*
* Virtual cape for I2C1 on connector pins P9.24 P9.26
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;
/plugin/;
#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/pinctrl/am33xx.h>
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";
// identification
part-number = "BB-I2C1A";
version = "00A0";
// resources this cape uses
exclusive-use =
"P9.24", // i2c1_sda
"P9.26", // i2c1_scl
"i2c1"; // hardware ip used
/*
* Free up the pins used by the cape from the pinmux helpers.
*/
fragment@0 {
target = <&ocp>;
__overlay__ {
P9_24_pinmux { status = "disabled"; }; /* i2c1_scl */
P9_26_pinmux { status = "disabled"; }; /* i2c1_sda */
};
};
fragment@1 {
target = <&am33xx_pinmux>;
__overlay__ {
bb_i2c1_pins: pinmux_bb_i2c1_pins {
pinctrl-single,pins = <
BONE_P9_24 0x73 /* uart1_tx.i2c1_sda, SLEWCTRL_SLOW | INPUT_PULLUP | MODE3 */
BONE_P9_26 0x73 /* uart1_rx.i2c1_scl, SLEWCTRL_SLOW | INPUT_PULLUP | MODE3 */
>;
};
};
};
fragment@2 {
target = <&i2c1>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_i2c1_pins>;
/* this is the configuration part */
clock-frequency = <400000>;
#address-cells = <1>;
#size-cells = <0>;
/* add any i2c devices on the bus here */
// commented out example of a touchscreen (taken from BB-BONE-LCD7-01-00A4) */
// maxtouch@4a {
// compatible = "mXT224";
// reg = <0x4a>;
// interrupt-parent = <&gpio4>;
// interrupts = <19 0x0>;
// atmel,irq-gpio = <&gpio4 19 0>;
// };
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment