Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/CPM: Add i2c pins to dts and board setup

Initialize I2C pins on boards with CPM1/CPM2 controllers and document the
i2c bus in booting-without-of.

The boards don't have any I2C chips connected to the I2C bus, so unless
some external chips are connected to the boards, this code is just an
example of setting everything else up.

Signed-off-by: Jochen Friedrich <jochen@scram.de>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

authored by

Jochen Friedrich and committed by
Kumar Gala
a5d28c8e dc320815

+86
+42
Documentation/powerpc/booting-without-of.txt
··· 2160 2160 }; 2161 2161 }; 2162 2162 2163 + x) I2C 2164 + 2165 + The I2C controller is expressed as a bus under the CPM node. 2166 + 2167 + Properties: 2168 + - compatible : "fsl,cpm1-i2c", "fsl,cpm2-i2c" 2169 + - reg : On CPM2 devices, the second resource doesn't specify the I2C 2170 + Parameter RAM itself, but the I2C_BASE field of the CPM2 Parameter RAM 2171 + (typically 0x8afc 0x2). 2172 + - #address-cells : Should be one. The cell is the i2c device address with 2173 + the r/w bit set to zero. 2174 + - #size-cells : Should be zero. 2175 + - clock-frequency : Can be used to set the i2c clock frequency. If 2176 + unspecified, a default frequency of 60kHz is being used. 2177 + The following two properties are deprecated. They are only used by legacy 2178 + i2c drivers to find the bus to probe: 2179 + - linux,i2c-index : Can be used to hard code an i2c bus number. By default, 2180 + the bus number is dynamically assigned by the i2c core. 2181 + - linux,i2c-class : Can be used to override the i2c class. The class is used 2182 + by legacy i2c device drivers to find a bus in a specific context like 2183 + system management, video or sound. By default, I2C_CLASS_HWMON (1) is 2184 + being used. The definition of the classes can be found in 2185 + include/i2c/i2c.h 2186 + 2187 + Example, based on mpc823: 2188 + 2189 + i2c@860 { 2190 + compatible = "fsl,mpc823-i2c", 2191 + "fsl,cpm1-i2c"; 2192 + reg = <0x860 0x20 0x3c80 0x30>; 2193 + interrupts = <16>; 2194 + interrupt-parent = <&CPM_PIC>; 2195 + fsl,cpm-command = <0x10>; 2196 + #address-cells = <1>; 2197 + #size-cells = <0>; 2198 + 2199 + rtc@68 { 2200 + compatible = "dallas,ds1307"; 2201 + reg = <0x68>; 2202 + }; 2203 + }; 2204 + 2163 2205 m) Chipselect/Local Bus 2164 2206 2165 2207 Properties:
+11
arch/powerpc/boot/dts/mpc8272ads.dts
··· 217 217 linux,network-index = <1>; 218 218 fsl,cpm-command = <0x16200300>; 219 219 }; 220 + 221 + i2c@11860 { 222 + compatible = "fsl,mpc8272-i2c", 223 + "fsl,cpm2-i2c"; 224 + reg = <0x11860 0x20 0x8afc 0x2>; 225 + interrupts = <1 8>; 226 + interrupt-parent = <&PIC>; 227 + fsl,cpm-command = <0x29600000>; 228 + #address-cells = <1>; 229 + #size-cells = <0>; 230 + }; 220 231 }; 221 232 222 233 PIC: interrupt-controller@10c00 {
+11
arch/powerpc/boot/dts/mpc866ads.dts
··· 171 171 fsl,cpm-command = <0000>; 172 172 linux,network-index = <1>; 173 173 }; 174 + 175 + i2c@860 { 176 + compatible = "fsl,mpc866-i2c", 177 + "fsl,cpm1-i2c"; 178 + reg = <0x860 0x20 0x3c80 0x30>; 179 + interrupts = <16>; 180 + interrupt-parent = <&CPM_PIC>; 181 + fsl,cpm-command = <0x10>; 182 + #address-cells = <1>; 183 + #size-cells = <0>; 184 + }; 174 185 }; 175 186 }; 176 187
+11
arch/powerpc/boot/dts/mpc885ads.dts
··· 215 215 fsl,cpm-command = <0x80>; 216 216 linux,network-index = <2>; 217 217 }; 218 + 219 + i2c@860 { 220 + compatible = "fsl,mpc885-i2c", 221 + "fsl,cpm1-i2c"; 222 + reg = <0x860 0x20 0x3c80 0x30>; 223 + interrupts = <16>; 224 + interrupt-parent = <&CPM_PIC>; 225 + fsl,cpm-command = <0x10>; 226 + #address-cells = <1>; 227 + #size-cells = <0>; 228 + }; 218 229 }; 219 230 }; 220 231
+4
arch/powerpc/platforms/82xx/mpc8272_ads.c
··· 96 96 {1, 31, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, 97 97 {2, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 98 98 {2, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, 99 + 100 + /* I2C */ 101 + {3, 14, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_OPENDRAIN}, 102 + {3, 15, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_OPENDRAIN}, 99 103 }; 100 104 101 105 static void __init init_ioports(void)
+4
arch/powerpc/platforms/8xx/mpc86xads_setup.c
··· 65 65 {CPM_PORTD, 13, CPM_PIN_OUTPUT}, 66 66 {CPM_PORTD, 14, CPM_PIN_OUTPUT}, 67 67 {CPM_PORTD, 15, CPM_PIN_OUTPUT}, 68 + 69 + /* I2C */ 70 + {CPM_PORTB, 26, CPM_PIN_INPUT | CPM_PIN_OPENDRAIN}, 71 + {CPM_PORTB, 27, CPM_PIN_INPUT | CPM_PIN_OPENDRAIN}, 68 72 }; 69 73 70 74 static void __init init_ioports(void)
+3
arch/powerpc/platforms/8xx/mpc885ads_setup.c
··· 158 158 {CPM_PORTE, 28, CPM_PIN_OUTPUT}, 159 159 {CPM_PORTE, 29, CPM_PIN_OUTPUT}, 160 160 #endif 161 + /* I2C */ 162 + {CPM_PORTB, 26, CPM_PIN_INPUT | CPM_PIN_OPENDRAIN}, 163 + {CPM_PORTB, 27, CPM_PIN_INPUT | CPM_PIN_OPENDRAIN}, 161 164 }; 162 165 163 166 static void __init init_ioports(void)