<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.linux.drivers.i2c">
    <title>gmane.linux.drivers.i2c</title>
    <link>http://blog.gmane.org/gmane.linux.drivers.i2c</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11356"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11354"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11353"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11352"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11351"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11350"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11347"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11346"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11345"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11344"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11343"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11341"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11339"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11338"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11337"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11336"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11334"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11330"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11329"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.linux.drivers.i2c/11328"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11356">
    <title>Re: [PATCH 8/8] i2c: i2c-bfin-twi: Move blackfin TWI register access Macro to head file.</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11356</link>
    <description>&lt;pre&gt;Great,

Apologies for the noise.
&lt;/pre&gt;</description>
    <dc:creator>Shubhrajyoti Datta</dc:creator>
    <dc:date>2012-05-25T10:16:06</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11354">
    <title>Re: [PATCH 8/8] i2c: i2c-bfin-twi: Move blackfin TWI register access Macro to head file.</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11354</link>
    <description>&lt;pre&gt;Hi ,
On Fri, May 25, 2012 at 3:24 PM, Zhang, Sonic &amp;lt;Sonic.Zhang-OyLXuOCK7orQT0dZR+AlfA&amp;lt; at &amp;gt;public.gmane.org&amp;gt; wrote:

Got it thanks.

You may want to add a dependency otherwise it might lead to a compilation break?


&lt;/pre&gt;</description>
    <dc:creator>Shubhrajyoti Datta</dc:creator>
    <dc:date>2012-05-25T10:10:16</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11353">
    <title>RE: [PATCH 8/8] i2c: i2c-bfin-twi: Move blackfin TWI register access Macro to head file.</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11353</link>
    <description>&lt;pre&gt;


The subject says these definitions are moved to a head file by the other patch for Blackfin architecture.

Regards,

Sonic



&lt;/pre&gt;</description>
    <dc:creator>Zhang, Sonic</dc:creator>
    <dc:date>2012-05-25T09:54:13</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11352">
    <title>Re: [PATCH 8/8] i2c: i2c-bfin-twi: Move blackfin TWI register access Macro to head file.</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11352</link>
    <description>&lt;pre&gt;Hi ,
Some minor comments/ doubts.
On Wed, May 16, 2012 at 12:50 PM,  &amp;lt;sonic.zhang-OyLXuOCK7orQT0dZR+AlfA&amp;lt; at &amp;gt;public.gmane.org&amp;gt; wrote:

A small description may be helpful.
Also the $SUBJECT says move the patch looks more like the remove.
Am I missing something.

&lt;/pre&gt;</description>
    <dc:creator>Shubhrajyoti Datta</dc:creator>
    <dc:date>2012-05-25T09:48:19</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11351">
    <title>Re: [PATCH 8/8] i2c: i2c-bfin-twi: Move blackfin TWI register access Macro to head file.</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11351</link>
    <description>&lt;pre&gt;PING

On Wed, May 16, 2012 at 3:20 PM,  &amp;lt;sonic.zhang-OyLXuOCK7orQT0dZR+AlfA&amp;lt; at &amp;gt;public.gmane.org&amp;gt; wrote:
&lt;/pre&gt;</description>
    <dc:creator>Sonic Zhang</dc:creator>
    <dc:date>2012-05-24T09:19:08</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11350">
    <title>Re: [PATCH 6/8] i2c:i2c-bfin-twi: include twi head file</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11350</link>
    <description>&lt;pre&gt;PING

On Wed, May 16, 2012 at 3:20 PM,  &amp;lt;sonic.zhang-OyLXuOCK7orQT0dZR+AlfA&amp;lt; at &amp;gt;public.gmane.org&amp;gt; wrote:
&lt;/pre&gt;</description>
    <dc:creator>Sonic Zhang</dc:creator>
    <dc:date>2012-05-24T09:18:32</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11347">
    <title>GET BACK TO ME ASAP.</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11347</link>
    <description>&lt;pre&gt;Good day my beloved friend,

How are you and your lovely family doing today,i hope all is well?if so glory 
be to God,i have an urgent purposal for you, if interested kindly contact me on 
this e-mail (anna_kennedy_hood-PkbjNfxxIAQqdlJmJB21zg&amp;lt; at &amp;gt;public.gmane.org)
&lt;/pre&gt;</description>
    <dc:creator>Mrs Anna Kennedy</dc:creator>
    <dc:date>2012-05-23T18:58:27</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11346">
    <title>[PATCH v4 7/7] ARM: davinci: add support for the am1808 based enbw_cmc board</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11346</link>
    <description>&lt;pre&gt;- AM1808 based board
- 64 MiB DDR ram
- 2 MiB Nor flash
- 128 MiB NAND flash
- use internal RTC
- I2C support
- hwmon lm75 support
- UBI/UBIFS support
- MMC support
- USB OTG support

Signed-off-by: Heiko Schocher &amp;lt;hs-ynQEQJNshbs&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r&amp;lt; at &amp;gt;public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ&amp;lt; at &amp;gt;public.gmane.org
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/&amp;lt; at &amp;gt;public.gmane.org
Cc: linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r&amp;lt; at &amp;gt;public.gmane.org
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA&amp;lt; at &amp;gt;public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA&amp;lt; at &amp;gt;public.gmane.org
Cc: David Woodhouse &amp;lt;dwmw2-wEGCiKHe2LqWVfeAwA7xHQ&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Ben Dooks &amp;lt;ben-linux-elnMNo+KYs3YtjvyW6yDsg&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Wolfram Sang &amp;lt;w.sang-bIcnvbaLZ9MEGnE8C9+IrQ&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Sekhar Nori &amp;lt;nsekhar-l0cyMroinI0&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Kevin Hilman &amp;lt;khilman-l0cyMroinI0&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Wolfgang Denk &amp;lt;wd-ynQEQJNshbs&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Scott Wood &amp;lt;scottwood-KZfg59tc24xl57MIdRCFDg&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Sylwester Nawrocki &amp;lt;s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ&amp;lt; at &amp;gt;public.gmane.org&amp;gt;

---
- post this board support with USB support, even though
  USB is only working with the 10 ms "workaround", posted here:
  http://comments.gmane.org/gmane.linux.usb.general/54505
  I see this issue also on the AM1808 TMDXEXP1808L evalboard.
- MMC and USB are not using OF support yet, ideas how to port
  this are welcome. I need for USB and MMC boards board
  specific callbacks, how to solve this with OF support?

- changes for v2:
  - changes in the nand node due to comments from Scott Wood:
    - add "ti,davinci-" prefix
    - Dashes are preferred to underscores
    - rename "nandflash" to "nand"
    - introduce new "ti,davinci" specific properties for setting
      up ecc_mode, ecc_bits, options and bbt options, instead
      using linux defines
  - changes for i2c due to comments from Sylwester Nawrocki:
    - use "cell-index" instead "id"
    - OF_DEV_AUXDATA in the machine code, instead pre-define
      platform device name
  - add comment from Grant Likely for i2c:
    - removed "id" resp. "cell-index" completely
    - fixed documentation
    - use of_match_ptr()
    - use devm_kzalloc() for allocating plattform data mem
    - fixed a whitespace issue
  - add net comments from Grant Likely:
    - add prefix "ti,davinci-" to davinci specific property names
    - remove version property
    - use compatible name "ti,davinci-dm6460-emac"
  - add comment from Grant Likely:
    - rename compatible node
    - do not use cell-index
    - CONFIG_OF required for this board
    TODO:
    - create a generic board support file, as I got no
      answer to my ping to grant, maybe this could be done
      in a second step?
- changes for v3:
  - add comments from Sergei Shtylyov:
    - rename compatible" prop to "ti,cp_intc"
    - cp_intc_init now used for Interrupt controller init
- changes for v4:
  add comment from Nori Sekhar:
  - rename davinci emac compatible property to "ti,davinci-dm6467-emac"
  - remove "pinmux-handle" property as discussed here:
    http://www.spinics.net/lists/arm-kernel/msg175701.html
    with Nori Sekhar
---
 arch/arm/boot/dts/enbw_cmc.dts                  |  172 +++++++++++
 arch/arm/configs/enbw_cmc_defconfig             |  123 ++++++++
 arch/arm/mach-davinci/Kconfig                   |    9 +
 arch/arm/mach-davinci/Makefile                  |    1 +
 arch/arm/mach-davinci/board-enbw-cmc.c          |  374 +++++++++++++++++++++++
 arch/arm/mach-davinci/include/mach/uncompress.h |    1 +
 6 files changed, 680 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/enbw_cmc.dts
 create mode 100644 arch/arm/configs/enbw_cmc_defconfig
 create mode 100644 arch/arm/mach-davinci/board-enbw-cmc.c

diff --git a/arch/arm/boot/dts/enbw_cmc.dts b/arch/arm/boot/dts/enbw_cmc.dts
new file mode 100644
index 0000000..2d5dea9
--- /dev/null
+++ b/arch/arm/boot/dts/enbw_cmc.dts
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,172 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+/*
+ * Device Tree for the EnBW CMC plattform
+ *
+ * Copyright 2011 DENX Software Engineering GmbH
+ * Heiko Schocher &amp;lt;hs-ynQEQJNshbs&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+/dts-v1/;
+/include/ "skeleton.dtsi"
+
+/ {
+model = "EnBW CMC";
+compatible = "enbw,cmc";
+
+aliases {
+ethernet0 = &amp;amp;eth0;
+};
+
+arm {
+#address-cells = &amp;lt;1&amp;gt;;
+#size-cells = &amp;lt;1&amp;gt;;
+ranges = &amp;lt;0 0xfffee000 0x00020000&amp;gt;;
+intc: interrupt-controller&amp;lt; at &amp;gt;1 {
+compatible = "ti,cp_intc";
+interrupt-controller;
+#interrupt-cells = &amp;lt;1&amp;gt;;
+ti,intc-size = &amp;lt;101&amp;gt;;
+reg = &amp;lt;0x0 0x2000&amp;gt;;
+};
+};
+soc&amp;lt; at &amp;gt;1c00000 {
+compatible = "ti,da850";
+#address-cells = &amp;lt;1&amp;gt;;
+#size-cells = &amp;lt;1&amp;gt;;
+ranges = &amp;lt;0x0 0x01c00000 0x400000&amp;gt;;
+
+serial0: serial&amp;lt; at &amp;gt;1c42000 {
+compatible = "ti,da850", "ns16550a";
+reg = &amp;lt;0x42000 0x100&amp;gt;;
+clock-frequency = &amp;lt;150000000&amp;gt;;
+reg-shift = &amp;lt;2&amp;gt;;
+interrupts = &amp;lt;25&amp;gt;;
+interrupt-parent = &amp;lt;&amp;amp;intc&amp;gt;;
+};
+serial1: serial&amp;lt; at &amp;gt;1d0c000 {
+compatible = "ti,da850", "ns16550a";
+reg = &amp;lt;0x10c000 0x100&amp;gt;;
+clock-frequency = &amp;lt;150000000&amp;gt;;
+reg-shift = &amp;lt;2&amp;gt;;
+interrupts = &amp;lt;53&amp;gt;;
+interrupt-parent = &amp;lt;&amp;amp;intc&amp;gt;;
+};
+serial2: serial&amp;lt; at &amp;gt;1d0d000 {
+compatible = "ti,da850", "ns16550a";
+reg = &amp;lt;0x10d000 0x100&amp;gt;;
+clock-frequency = &amp;lt;150000000&amp;gt;;
+reg-shift = &amp;lt;2&amp;gt;;
+interrupts = &amp;lt;61&amp;gt;;
+interrupt-parent = &amp;lt;&amp;amp;intc&amp;gt;;
+};
+
+eth0: emac&amp;lt; at &amp;gt;1e20000 {
+compatible = "ti,davinci-dm6467-emac";
+reg = &amp;lt;0x220000 0x4000&amp;gt;;
+ti,davinci-ctrl-reg-offset = &amp;lt;0x3000&amp;gt;;
+ti,davinci-ctrl-mod-reg-offset = &amp;lt;0x2000&amp;gt;;
+ti,davinci-ctrl-ram-offset = &amp;lt;0&amp;gt;;
+ti,davinci-ctrl-ram-size = &amp;lt;0x2000&amp;gt;;
+local-mac-address = [ 00 00 00 00 00 00 ];
+interrupts = &amp;lt;33
+34
+35
+36
+&amp;gt;;
+interrupt-parent = &amp;lt;&amp;amp;intc&amp;gt;;
+};
+
+i2c&amp;lt; at &amp;gt;1c22000 {
+compatible = "ti,davinci-i2c";
+reg = &amp;lt;0x22000 0x1000&amp;gt;;
+clock-frequency = &amp;lt;100000&amp;gt;;
+interrupts = &amp;lt;15&amp;gt;;
+interrupt-parent = &amp;lt;&amp;amp;intc&amp;gt;;
+#address-cells = &amp;lt;1&amp;gt;;
+#size-cells = &amp;lt;0&amp;gt;;
+
+dtt&amp;lt; at &amp;gt;48 {
+compatible = "national,lm75";
+reg = &amp;lt;0x48&amp;gt;;
+};
+};
+};
+onchipram&amp;lt; at &amp;gt;8000000 {
+compatible = "ti,davinci-onchipram";
+#address-cells = &amp;lt;1&amp;gt;;
+#size-cells = &amp;lt;1&amp;gt;;
+ranges = &amp;lt;0x0 0x80000000 0x20000&amp;gt;;
+};
+aemif&amp;lt; at &amp;gt;60000000 {
+compatible = "ti,davinci-aemif";
+#address-cells = &amp;lt;2&amp;gt;;
+#size-cells = &amp;lt;1&amp;gt;;
+reg = &amp;lt;0x68000000 0x80000&amp;gt;;
+ranges = &amp;lt;2 0 0x60000000 0x02000000
+  3 0 0x62000000 0x02000000
+  4 0 0x64000000 0x02000000
+  5 0 0x66000000 0x02000000
+  6 0 0x68000000 0x02000000&amp;gt;;
+cs2&amp;lt; at &amp;gt;68000000 {
+compatible = "ti,davinci-cs";
+#address-cells = &amp;lt;1&amp;gt;;
+#size-cells = &amp;lt;1&amp;gt;;
+/* all timings in nanoseconds */
+cs = &amp;lt;2&amp;gt;;
+asize = &amp;lt;1&amp;gt;;
+ta = &amp;lt;0&amp;gt;;
+rhold = &amp;lt;7&amp;gt;;
+rstrobe = &amp;lt;42&amp;gt;;
+rsetup = &amp;lt;14&amp;gt;;
+whold = &amp;lt;7&amp;gt;;
+wstrobe = &amp;lt;42&amp;gt;;
+wsetup = &amp;lt;14&amp;gt;;
+ew = &amp;lt;0&amp;gt;;
+ss = &amp;lt;0&amp;gt;;
+};
+flash&amp;lt; at &amp;gt;2,0 {
+compatible = "cfi-flash";
+reg = &amp;lt;2 0x0 0x400000&amp;gt;;
+#address-cells = &amp;lt;1&amp;gt;;
+#size-cells = &amp;lt;1&amp;gt;;
+bank-width = &amp;lt;2&amp;gt;;
+device-width = &amp;lt;2&amp;gt;;
+};
+nand_cs: cs3&amp;lt; at &amp;gt;68000000 {
+compatible = "ti,davinci-cs";
+#address-cells = &amp;lt;1&amp;gt;;
+#size-cells = &amp;lt;1&amp;gt;;
+/* all timings in nanoseconds */
+cs = &amp;lt;3&amp;gt;;
+asize = &amp;lt;0&amp;gt;;
+ta = &amp;lt;0&amp;gt;;
+rhold = &amp;lt;7&amp;gt;;
+rstrobe = &amp;lt;42&amp;gt;;
+rsetup = &amp;lt;7&amp;gt;;
+whold = &amp;lt;7&amp;gt;;
+wstrobe = &amp;lt;14&amp;gt;;
+wsetup = &amp;lt;7&amp;gt;;
+ew = &amp;lt;0&amp;gt;;
+ss = &amp;lt;0&amp;gt;;
+};
+nand&amp;lt; at &amp;gt;3,0 {
+compatible = "ti,davinci-nand";
+reg = &amp;lt;3 0x0 0x807ff
+6 0x0 0x8000&amp;gt;;
+#address-cells = &amp;lt;1&amp;gt;;
+#size-cells = &amp;lt;1&amp;gt;;
+ti,davinci-chipselect = &amp;lt;1&amp;gt;;
+ti,davinci-mask-ale = &amp;lt;0&amp;gt;;
+ti,davinci-mask-cle = &amp;lt;0&amp;gt;;
+ti,davinci-mask-chipsel = &amp;lt;0&amp;gt;;
+ti,davinci-ecc-mode = "hw";
+ti,davinci-ecc-bits = &amp;lt;4&amp;gt;;
+ti,davinci-nand-use-bbt;
+timing-handle = &amp;lt;&amp;amp;nand_cs&amp;gt;;
+};
+
+};
+};
diff --git a/arch/arm/configs/enbw_cmc_defconfig b/arch/arm/configs/enbw_cmc_defconfig
new file mode 100644
index 0000000..9d98e7f
--- /dev/null
+++ b/arch/arm/configs/enbw_cmc_defconfig
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,123 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+CONFIG_EXPERIMENTAL=y
+# CONFIG_SWAP is not set
+CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_EXPERT=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_BLK_DEV_BSG is not set
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+CONFIG_ARCH_DAVINCI=y
+CONFIG_ARCH_DAVINCI_DA850=y
+# CONFIG_MACH_DAVINCI_DA850_EVM is not set
+CONFIG_GPIO_PCA953X=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_PREEMPT=y
+CONFIG_AEABI=y
+# CONFIG_OABI_COMPAT is not set
+CONFIG_USE_OF=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_INET_LRO is not set
+CONFIG_IPV6=y
+CONFIG_NETFILTER=y
+# CONFIG_WIRELESS is not set
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_FW_LOADER is not set
+CONFIG_MTD=y
+CONFIG_MTD_CMDLINE_PARTS=y
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_CFI=y
+CONFIG_MTD_CFI_INTELEXT=y
+CONFIG_MTD_CFI_AMDSTD=y
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_OF=y
+CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_DAVINCI=y
+CONFIG_MTD_UBI=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=1
+CONFIG_BLK_DEV_RAM_SIZE=32768
+CONFIG_EEPROM_AT24=y
+CONFIG_SCSI=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_NETDEVICES=y
+CONFIG_MII=y
+CONFIG_TI_DAVINCI_EMAC=y
+# CONFIG_WLAN is not set
+CONFIG_INPUT_POLLDEV=y
+# CONFIG_INPUT_MOUSEDEV is not set
+CONFIG_INPUT_EVDEV=y
+CONFIG_INPUT_EVBUG=y
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
+# CONFIG_VT is not set
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=3
+CONFIG_SERIAL_8250_RUNTIME_UARTS=3
+CONFIG_SERIAL_OF_PLATFORM=y
+CONFIG_HW_RANDOM=y
+CONFIG_I2C=y
+CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_DAVINCI=y
+CONFIG_GPIO_SYSFS=y
+CONFIG_GPIO_PCF857X=y
+CONFIG_SENSORS_LM75=y
+CONFIG_WATCHDOG=y
+CONFIG_WATCHDOG_CORE=y
+CONFIG_DAVINCI_WATCHDOG=y
+# CONFIG_HID_SUPPORT is not set
+CONFIG_USB=y
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
+CONFIG_USB_MUSB_HDRC=y
+CONFIG_USB_MUSB_DA8XX=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_UAS=y
+CONFIG_USB_LIBUSUAL=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_FUSB300=y
+CONFIG_USB_ETH=y
+CONFIG_MMC=y
+CONFIG_MMC_DAVINCI=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_OMAP=y
+CONFIG_EXT2_FS=y
+CONFIG_EXT3_FS=y
+CONFIG_AUTOFS4_FS=y
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_TMPFS=y
+CONFIG_UBIFS_FS=y
+CONFIG_CRAMFS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+CONFIG_ROOT_NFS=y
+CONFIG_NLS_CODEPAGE_437=y
+CONFIG_NLS_ASCII=y
+CONFIG_NLS_ISO8859_1=y
+CONFIG_NLS_UTF8=y
+CONFIG_DEBUG_FS=y
+CONFIG_TIMER_STATS=y
+CONFIG_DEBUG_RT_MUTEXES=y
+CONFIG_DEBUG_MUTEXES=y
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+# CONFIG_CRYPTO_HW is not set
+CONFIG_CRC_CCITT=m
+CONFIG_CRC_T10DIF=m
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index 32d837d..4cb0469 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -202,6 +202,15 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; config DA850_WL12XX
   Say Y if you want to use a wl1271 expansion card connected to the
   AM18x EVM.
 
+config MACH_ENBW_CMC
+bool "EnBW Communication Module Compact"
+default ARCH_DAVINCI_DA850
+depends on ARCH_DAVINCI_DA850
+select OF
+help
+  Say Y here to select the EnBW Communication Module Compact
+  board.
+
 config GPIO_PCA953X
 default MACH_DAVINCI_DA850_EVM
 
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile
index 2db78bd..12f3166 100644
--- a/arch/arm/mach-davinci/Makefile
+++ b/arch/arm/mach-davinci/Makefile
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -34,6 +34,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; obj-$(CONFIG_MACH_DAVINCI_DA850_EVM)+= board-da850-evm.o
 obj-$(CONFIG_MACH_TNETV107X)+= board-tnetv107x-evm.o
 obj-$(CONFIG_MACH_MITYOMAPL138)+= board-mityomapl138.o
 obj-$(CONFIG_MACH_OMAPL138_HAWKBOARD)+= board-omapl138-hawk.o
+obj-$(CONFIG_MACH_ENBW_CMC)+= board-enbw-cmc.o
 
 # Power Management
 obj-$(CONFIG_CPU_FREQ)+= cpufreq.o
diff --git a/arch/arm/mach-davinci/board-enbw-cmc.c b/arch/arm/mach-davinci/board-enbw-cmc.c
new file mode 100644
index 0000000..fcec14f
--- /dev/null
+++ b/arch/arm/mach-davinci/board-enbw-cmc.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,374 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+/*
+ * EnBW Communication Module Compact board
+ * Copyright 2011 DENX Software Engineering GmbH
+ * Author: Heiko Schocher &amp;lt;hs-ynQEQJNshbs&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
+ *
+ * based on:
+ * TI DA850/OMAP-L138 EVM board
+ *
+ * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * Derived from: arch/arm/mach-davinci/board-da850-evm.c
+ * Original Copyrights follow:
+ *
+ * 2007, 2009 (c) MontaVista Software, Inc. This file is licensed under
+ * the terms of the GNU General Public License version 2. This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+#include &amp;lt;linux/console.h&amp;gt;
+#include &amp;lt;linux/gpio.h&amp;gt;
+#include &amp;lt;linux/gpio_keys.h&amp;gt;
+#include &amp;lt;linux/i2c.h&amp;gt;
+#include &amp;lt;linux/init.h&amp;gt;
+#include &amp;lt;linux/kernel.h&amp;gt;
+#include &amp;lt;linux/mtd/mtd.h&amp;gt;
+#include &amp;lt;linux/mtd/nand.h&amp;gt;
+#include &amp;lt;linux/mtd/partitions.h&amp;gt;
+#include &amp;lt;linux/mtd/physmap.h&amp;gt;
+#include &amp;lt;linux/of.h&amp;gt;
+#include &amp;lt;linux/of_net.h&amp;gt;
+#include &amp;lt;linux/of_address.h&amp;gt;
+#include &amp;lt;linux/of_platform.h&amp;gt;
+#include &amp;lt;linux/phy.h&amp;gt;
+#include &amp;lt;linux/phy_fixed.h&amp;gt;
+#include &amp;lt;linux/platform_device.h&amp;gt;
+#include &amp;lt;linux/spi/spi.h&amp;gt;
+#include &amp;lt;linux/spi/flash.h&amp;gt;
+#include &amp;lt;asm/mach-types.h&amp;gt;
+#include &amp;lt;asm/mach/arch.h&amp;gt;
+#include &amp;lt;mach/aemif.h&amp;gt;
+#include &amp;lt;mach/cp_intc.h&amp;gt;
+#include &amp;lt;mach/da8xx.h&amp;gt;
+#include &amp;lt;mach/mux.h&amp;gt;
+#include &amp;lt;mach/nand.h&amp;gt;
+#include &amp;lt;mach/spi.h&amp;gt;
+
+#define ENBW_CMC_MMCSD_CD_PIN          GPIO_TO_PIN(3, 13)
+
+/*
+ * USB1 VBUS is controlled by GPIO7[12], over-current is reported on GPIO7[8].
+ */
+#define DA850_USB_VBUS_PINGPIO_TO_PIN(7, 12)
+#define ON_BD_USB_OVCGPIO_TO_PIN(7, 8)
+
+#if defined(CONFIG_USB_OHCI_HCD)
+static irqreturn_t enbw_cmc_usb_ocic_irq(int irq, void *dev_id);
+static da8xx_ocic_handler_t enbw_cmc_usb_ocic_handler;
+
+static int enbw_cmc_usb_set_power(unsigned port, int on)
+{
+gpio_set_value(DA850_USB_VBUS_PIN, on);
+return 0;
+}
+
+static int enbw_cmc_usb_get_power(unsigned port)
+{
+return gpio_get_value(DA850_USB_VBUS_PIN);
+}
+
+static int enbw_cmc_usb_get_oci(unsigned port)
+{
+return !gpio_get_value(ON_BD_USB_OVC);
+}
+
+static irqreturn_t enbw_cmc_usb_ocic_irq(int, void *);
+
+static int enbw_cmc_usb_ocic_notify(da8xx_ocic_handler_t handler)
+{
+int irq         = gpio_to_irq(ON_BD_USB_OVC);
+int error       = 0;
+
+if (handler != NULL) {
+enbw_cmc_usb_ocic_handler = handler;
+
+error = request_irq(irq, enbw_cmc_usb_ocic_irq,
+IRQF_DISABLED | IRQF_TRIGGER_RISING |
+IRQF_TRIGGER_FALLING,
+"OHCI over-current indicator", NULL);
+if (error)
+pr_err("%s: could not request IRQ to watch "
+"over-current indicator changes\n", __func__);
+} else {
+free_irq(irq, NULL);
+}
+return error;
+}
+
+static struct da8xx_ohci_root_hub enbw_cmc_usb11_pdata = {
+.set_power      = enbw_cmc_usb_set_power,
+.get_power      = enbw_cmc_usb_get_power,
+.get_oci        = enbw_cmc_usb_get_oci,
+.ocic_notify    = enbw_cmc_usb_ocic_notify,
+.potpgt         = (10 + 1) / 2,  /* 10 ms max */
+};
+
+static irqreturn_t enbw_cmc_usb_ocic_irq(int irq, void *dev_id)
+{
+enbw_cmc_usb_ocic_handler(&amp;amp;enbw_cmc_usb11_pdata, 1);
+return IRQ_HANDLED;
+}
+#endif
+
+static __init void enbw_cmc_usb_init(void)
+{
+int ret;
+u32 cfgchip2;
+
+/* Set up USB clock/mode in the CFGCHIP2 register. */
+cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+
+/* USB2.0 PHY reference clock is AUXCLK with 24MHz */
+cfgchip2 &amp;amp;= ~CFGCHIP2_REFFREQ;
+cfgchip2 |=  CFGCHIP2_REFFREQ_24MHZ;
+
+/*
+ * Select internal reference clock for USB 2.0 PHY
+ * and use it as a clock source for USB 1.1 PHY
+ * (this is the default setting anyway).
+ */
+cfgchip2 &amp;amp;= ~CFGCHIP2_USB1PHYCLKMUX;
+cfgchip2 |=  CFGCHIP2_USB2PHYCLKMUX;
+
+cfgchip2 &amp;amp;= ~CFGCHIP2_OTGMODE;
+cfgchip2 |=  CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN;
+
+__raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+
+/*
+ * SP2525A &amp;lt; at &amp;gt; 5V supplies 500mA,
+ * with the power on to power good time of 10 ms.
+ */
+ret = da8xx_register_usb20(500, 10);
+if (ret)
+pr_warning("%s: USB 2.0 registration failed: %d\n",
+   __func__, ret);
+
+#if defined(CONFIG_USB_OHCI_HCD)
+ret = gpio_request_one(DA850_USB_VBUS_PIN,
+GPIOF_DIR_OUT, "USB 1.1 VBUS");
+if (ret &amp;lt; 0) {
+pr_err("%s: failed to request GPIO for USB 1.1 port "
+"power control: %d\n", __func__, ret);
+return;
+}
+gpio_direction_input(DA850_USB_VBUS_PIN);
+
+ret = gpio_request(ON_BD_USB_OVC, "ON_BD_USB_OVC");
+if (ret) {
+printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
+       "over-current indicator: %d\n", __func__, ret);
+gpio_free(DA850_USB_VBUS_PIN);
+return;
+}
+gpio_direction_input(ON_BD_USB_OVC);
+
+ret = da8xx_register_usb11(&amp;amp;enbw_cmc_usb11_pdata);
+if (ret) {
+pr_warning("%s: USB 1.1 registration failed: %d\n",
+   __func__, ret);
+gpio_free(ON_BD_USB_OVC);
+gpio_free(DA850_USB_VBUS_PIN);
+}
+#endif
+
+return;
+}
+
+static int enbw_cmc_mmc_get_ro(int index)
+{
+return 0;
+}
+
+static int enbw_cmc_mmc_get_cd(int index)
+{
+return gpio_get_value(ENBW_CMC_MMCSD_CD_PIN) ? 1 : 0;
+}
+
+static struct davinci_mmc_config enbw_cmc_mmc_config = {
+.get_ro= enbw_cmc_mmc_get_ro,
+.get_cd= enbw_cmc_mmc_get_cd,
+.wires= 4,
+.max_freq= 50000000,
+.caps= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
+.version= MMC_CTLR_VERSION_2,
+};
+
+static int __init enbw_cmc_config_emac(void)
+{
+void __iomem *cfg_chip3_base;
+u32 val;
+struct davinci_soc_info *soc_info = &amp;amp;davinci_soc_info;
+
+if (!machine_is_enbw_cmc())
+return 0;
+
+cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
+val = __raw_readl(cfg_chip3_base);
+val &amp;amp;= ~BIT(8);
+pr_info("EMAC: MII PHY configured, RMII PHY will not be"
+" functional\n");
+
+/* configure the CFGCHIP3 register for MII */
+__raw_writel(val, cfg_chip3_base);
+
+/* use complete info from OF */
+soc_info-&amp;gt;emac_pdata = NULL;
+
+return 0;
+}
+device_initcall(enbw_cmc_config_emac);
+
+static const s16 da850_dma0_rsv_chans[][2] = {
+/* (offset, number) */
+{-1, -1}
+};
+
+static const s16 da850_dma0_rsv_slots[][2] = {
+/* (offset, number) */
+{-1, -1}
+};
+
+static const s16 da850_dma1_rsv_chans[][2] = {
+/* (offset, number) */
+{-1, -1}
+};
+
+static const s16 da850_dma1_rsv_slots[][2] = {
+/* (offset, number) */
+{-1, -1}
+};
+
+static struct edma_rsv_info da850_edma_cc0_rsv = {
+.rsv_chans= da850_dma0_rsv_chans,
+.rsv_slots= da850_dma0_rsv_slots,
+};
+
+static struct edma_rsv_info da850_edma_cc1_rsv = {
+.rsv_chans= da850_dma1_rsv_chans,
+.rsv_slots= da850_dma1_rsv_slots,
+};
+
+static struct edma_rsv_info *da850_edma_rsv[2] = {
+&amp;amp;da850_edma_cc0_rsv,
+&amp;amp;da850_edma_cc1_rsv,
+};
+
+#ifdef CONFIG_CPU_FREQ
+static __init int da850_evm_init_cpufreq(void)
+{
+switch (system_rev &amp;amp; 0xF) {
+case 3:
+da850_max_speed = 456000;
+break;
+case 2:
+da850_max_speed = 408000;
+break;
+case 1:
+da850_max_speed = 372000;
+break;
+}
+
+return da850_register_cpufreq("pll0_sysclk3");
+}
+#else
+static __init int da850_evm_init_cpufreq(void) { return 0; }
+#endif
+
+struct of_dev_auxdata enbw_cmc_auxdata_lookup[] __initdata = {
+OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "ti,davinci-wdt", NULL),
+OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL),
+OF_DEV_AUXDATA("ti,davinci-i2c", 0x01e28000, "i2c_davinci.2", NULL),
+OF_DEV_AUXDATA("ti,davinci-dm6467-emac", 0x01e20000, "davinci_emac.1",
+NULL),
+{}
+};
+
+const struct of_device_id enbw_cmc_bus_match_table[] = {
+{ .compatible = "simple-bus", },
+{ .compatible = "ti,da850", },
+{ .compatible = "ti,davinci-onchipram", },
+{ .compatible = "ti,davinci-aemif", },
+{} /* Empty terminated list */
+};
+
+static __init void enbw_cmc_init(void)
+{
+int ret;
+
+of_platform_populate(NULL, enbw_cmc_bus_match_table,
+enbw_cmc_auxdata_lookup, NULL);
+
+ret = da8xx_register_watchdog();
+if (ret)
+pr_warning("enbw_cmc_init: watchdog registration failed: %d\n",
+ret);
+
+ret = da850_register_edma(da850_edma_rsv);
+if (ret)
+pr_warning("enbw_cmc_init: edma registration failed: %d\n",
+ret);
+
+/*
+ * shut down uart 0 this port is not used on the board
+ */
+__raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30);
+
+ret = da8xx_register_rtc();
+if (ret)
+pr_warning("enbw_cmc_init: rtc setup failed: %d\n", ret);
+
+ret = da850_evm_init_cpufreq();
+if (ret)
+pr_warning("enbw_cmc_init: cpufreq registration failed: %d\n",
+ret);
+
+ret = da8xx_register_cpuidle();
+if (ret)
+pr_warning("enbw_cmc_init: cpuidle registration failed: %d\n",
+ret);
+
+ret = gpio_request(ENBW_CMC_MMCSD_CD_PIN, "MMC CD\n");
+if (ret)
+pr_warning("enbw_cmc_init: can not open GPIO %d\n",
+ENBW_CMC_MMCSD_CD_PIN);
+gpio_direction_input(ENBW_CMC_MMCSD_CD_PIN);
+
+ret = da850_register_mmcsd1(&amp;amp;enbw_cmc_mmc_config);
+if (ret)
+pr_warning("enbw_cmc_init: mmcsd1 registration failed:"
+" %d\n", ret);
+
+enbw_cmc_usb_init();
+}
+
+#ifdef CONFIG_SERIAL_8250_CONSOLE
+static int __init enbw_cmc_console_init(void)
+{
+if (!machine_is_enbw_cmc())
+return 0;
+
+return add_preferred_console("ttyS", 2, "115200");
+}
+console_initcall(enbw_cmc_console_init);
+#endif
+
+static void __init enbw_cmc_map_io(void)
+{
+da850_init();
+}
+
+static const char *enbw_cmc_board_compat[] __initconst = {
+"enbw,cmc",
+NULL
+};
+
+MACHINE_START(ENBW_CMC, "EnBW CMC")
+.map_io= enbw_cmc_map_io,
+.init_irq= cp_intc_init,
+.timer= &amp;amp;davinci_timer,
+.init_machine= enbw_cmc_init,
+.dt_compat= enbw_cmc_board_compat,
+.dma_zone_size= SZ_128M,
+.restart= da8xx_restart,
+MACHINE_END
diff --git a/arch/arm/mach-davinci/include/mach/uncompress.h b/arch/arm/mach-davinci/include/mach/uncompress.h
index da2fb2c..6119543 100644
--- a/arch/arm/mach-davinci/include/mach/uncompress.h
+++ b/arch/arm/mach-davinci/include/mach/uncompress.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -98,6 +98,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static inline void __arch_decomp_setup(unsigned long arch_id)
 DEBUG_LL_DA8XX(davinci_da850_evm,2);
 DEBUG_LL_DA8XX(mityomapl138,1);
 DEBUG_LL_DA8XX(omapl138_hawkboard,2);
+DEBUG_LL_DA8XX(enbw_cmc,2);
 
 /* TNETV107x boards */
 DEBUG_LL_TNETV107X(tnetv107x,1);
&lt;/pre&gt;</description>
    <dc:creator>Heiko Schocher</dc:creator>
    <dc:date>2012-05-22T13:55:20</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11345">
    <title>[PATCH v4 0/7] ARM: davinci: add support for the am1808 based enbw_cmc board</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11345</link>
    <description>&lt;pre&gt;this patchserie add support for the davinci am1808 based
enbw_cmc board.

changes for v2:
Post this patchserie now as v2, as reworked in the
comments I got for the RFC serie.

changes for v3:
- Interrupt Controller:
  - comment from Sergei Shtylyov:
    - rename compatible" prop to "ti,cp_intc"
    - cp_intc_init() is now also for the of case
      the name of the init function (it calls the
      "new" __cp_intc_init() function, which was
      the "old" cp_intc_init()). Through this
      rework the changes for OF is better visible.
      As the OF case uses the irq_domain rework from
      Grant Likely, maybe the none OF case can use
      this also, but this should be tested on a hw ...

changes for v4:
- Interrupt Controller:
  - split in two patches as Nori Sekhar suggested
    one for the irq_domain change
    one for DT support
  - add comment from Grant Likely for the DT part:
    remove if/else clause, not needed.
    Make use of DT runtime configurable
    The non OF case is not tested!
     
Got no comments to the following points, I noted in the
RFC series, so posting this patchseries with them:

- ARM: davinci: configure davinci aemif chipselects through OF
  not moved to mfd, as mentioned in this discussion:
  http://davinci-linux-open-source.1494791.n2.nabble.com/PATCH-arm-davinci-configure-davinci-aemif-chipselects-through-OF-td7059739.html
  instead use a phandle in the DTS, so drivers which
  uses the davinci aemif, can call davinci_aemif_setup_timing_of()

  This is just thought as an RFC ... The enbw_cmc board
  support not really need to setup this bus timings, as
  they are setup in U-Boot ... but I want to post this,
  as I think, it is a nice to have, and I am not really
  sure, if this has to be a MFD device (If so, all bus
  interfaces for other SoCs should be converted also to
  MFD devices) ... as an example how this can be used
  I add this to the davinci nand controller OF support
  patch, in this patchserie.

- ARM: davinci: mux: add OF support
  I want to get rid of the pin setup code in board code ...
  This patch introduces a davinci_cfg_reg_of() function,
  which davinci drivers can call, if they found a
  "pinmux-handle", so used in the following drivers in
  this patchserie:

  drivers/net/ethernet/ti/davinci_emac
  drivers/i2c/busses/i2c-davinci.c
  drivers/mtd/nand/davinci_nand.c

  This is removed for v4 serie, as Nori Sekhar suggested.

- post this board support with USB support, even though
  USB is only working with the 10 ms "workaround", posted here:
  http://comments.gmane.org/gmane.linux.usb.general/54505
  I see this issue also on the AM1808 TMDXEXP1808L evalboard.

  change for v4:
  The 10 ms delay is no longer needed, see discussion here:

  http://www.spinics.net/lists/linux-usb/msg64232.html

  shows the way to go ...

- MMC and USB are not using OF support yet, ideas how to port
  this are welcome. I need for USB and MMC board specific
  callbacks, how to solve this with OF support?

Signed-off-by: Heiko Schocher &amp;lt;hs-ynQEQJNshbs&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r&amp;lt; at &amp;gt;public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ&amp;lt; at &amp;gt;public.gmane.org
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/&amp;lt; at &amp;gt;public.gmane.org
Cc: linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r&amp;lt; at &amp;gt;public.gmane.org
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA&amp;lt; at &amp;gt;public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA&amp;lt; at &amp;gt;public.gmane.org
Cc: David Woodhouse &amp;lt;dwmw2-wEGCiKHe2LqWVfeAwA7xHQ&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Ben Dooks &amp;lt;ben-linux-elnMNo+KYs3YtjvyW6yDsg&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Wolfram Sang &amp;lt;w.sang-bIcnvbaLZ9MEGnE8C9+IrQ&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Sekhar Nori &amp;lt;nsekhar-l0cyMroinI0&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Kevin Hilman &amp;lt;khilman-l0cyMroinI0&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Wolfgang Denk &amp;lt;wd-ynQEQJNshbs&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Sergei Shtylyov &amp;lt;sshtylyov-Igf4POYTYCDQT0dZR+AlfA&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Grant Likely &amp;lt;grant.likely-s3s/WqlpOiPyB63q8FvJNQ&amp;lt; at &amp;gt;public.gmane.org&amp;gt;

Heiko Schocher (7):
  ARM: davinci, intc: Add irq domain support
  ARM: davinci, intc: Add OF support for TI interrupt controller
  ARM: davinci: configure davinci aemif chipselects through OF
  ARM: davinci: net: davinci_emac: add OF support
  ARM: davinci: i2c: add OF support
  ARM: mtd: nand: davinci: add OF support for davinci nand controller
  ARM: davinci: add support for the am1808 based enbw_cmc board

 .../devicetree/bindings/arm/davinci/aemif.txt      |  119 +++++++
 .../devicetree/bindings/arm/davinci/i2c.txt        |   31 ++
 .../devicetree/bindings/arm/davinci/intc.txt       |   27 ++
 .../devicetree/bindings/arm/davinci/nand.txt       |   72 ++++
 .../devicetree/bindings/net/davinci_emac.txt       |   41 +++
 arch/arm/boot/dts/enbw_cmc.dts                     |  172 +++++++++
 arch/arm/configs/enbw_cmc_defconfig                |  123 +++++++
 arch/arm/mach-davinci/Kconfig                      |    9 +
 arch/arm/mach-davinci/Makefile                     |    1 +
 arch/arm/mach-davinci/aemif.c                      |   86 +++++-
 arch/arm/mach-davinci/board-enbw-cmc.c             |  374 ++++++++++++++++++++
 arch/arm/mach-davinci/cp_intc.c                    |   74 ++++-
 arch/arm/mach-davinci/include/mach/aemif.h         |    1 +
 arch/arm/mach-davinci/include/mach/uncompress.h    |    1 +
 drivers/i2c/busses/i2c-davinci.c                   |   32 ++
 drivers/mtd/nand/davinci_nand.c                    |   80 ++++-
 drivers/net/ethernet/ti/davinci_emac.c             |   87 +++++-
 17 files changed, 1317 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/davinci/aemif.txt
 create mode 100644 Documentation/devicetree/bindings/arm/davinci/i2c.txt
 create mode 100644 Documentation/devicetree/bindings/arm/davinci/intc.txt
 create mode 100644 Documentation/devicetree/bindings/arm/davinci/nand.txt
 create mode 100644 Documentation/devicetree/bindings/net/davinci_emac.txt
 create mode 100644 arch/arm/boot/dts/enbw_cmc.dts
 create mode 100644 arch/arm/configs/enbw_cmc_defconfig
 create mode 100644 arch/arm/mach-davinci/board-enbw-cmc.c

&lt;/pre&gt;</description>
    <dc:creator>Heiko Schocher</dc:creator>
    <dc:date>2012-05-22T13:55:13</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11344">
    <title>[PATCH v4 5/7] ARM: davinci: i2c: add OF support</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11344</link>
    <description>&lt;pre&gt;add of support for the davinci i2c driver.

Signed-off-by: Heiko Schocher &amp;lt;hs-ynQEQJNshbs&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/&amp;lt; at &amp;gt;public.gmane.org
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r&amp;lt; at &amp;gt;public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ&amp;lt; at &amp;gt;public.gmane.org
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA&amp;lt; at &amp;gt;public.gmane.org
Cc: Ben Dooks &amp;lt;ben-linux-elnMNo+KYs3YtjvyW6yDsg&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Wolfram Sang &amp;lt;w.sang-bIcnvbaLZ9MEGnE8C9+IrQ&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Grant Likely &amp;lt;grant.likely-s3s/WqlpOiPyB63q8FvJNQ&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Sekhar Nori &amp;lt;nsekhar-l0cyMroinI0&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Wolfgang Denk &amp;lt;wd-ynQEQJNshbs&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
Cc: Sylwester Nawrocki &amp;lt;s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ&amp;lt; at &amp;gt;public.gmane.org&amp;gt;

---
- changes for v2:
- add comments from Sylwester Nawrocki &amp;lt;s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ&amp;lt; at &amp;gt;public.gmane.org&amp;gt;:
  - use "cell-index" instead "id"
  - OF_DEV_AUXDATA in the machine code, instead pre-define platform
    device name
- add comment from Grant Likely:
  - removed "id" resp. "cell-index" completely
  - fixed documentation
  - use of_match_ptr()
  - use devm_kzalloc() for allocating plattform data mem
  - fixed a whitespace issue
- no changes for v3
- changes for v4
  remove "pinmux-handle" property as discussed here:
  http://www.spinics.net/lists/arm-kernel/msg175701.html
  with Nori Sekhar
---
 .../devicetree/bindings/arm/davinci/i2c.txt        |   31 +++++++++++++++++++
 drivers/i2c/busses/i2c-davinci.c                   |   32 ++++++++++++++++++++
 2 files changed, 63 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/davinci/i2c.txt

diff --git a/Documentation/devicetree/bindings/arm/davinci/i2c.txt b/Documentation/devicetree/bindings/arm/davinci/i2c.txt
new file mode 100644
index 0000000..e98a025
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/davinci/i2c.txt
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,31 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+* Texas Instruments Davinci I2C
+
+This file provides information, what the device node for the
+davinci i2c interface contain.
+
+Required properties:
+- compatible: "ti,davinci-i2c";
+- reg : Offset and length of the register set for the device
+
+Recommended properties :
+- interrupts : &amp;lt;a&amp;gt; standard interrupt property.
+- clock-frequency : desired I2C bus clock frequency in Hz.
+
+Optional properties:
+- bus-delay: bus delay in usec
+
+Example (enbw_cmc board):
+i2c&amp;lt; at &amp;gt;1c22000 {
+compatible = "ti,davinci-i2c";
+reg = &amp;lt;0x22000 0x1000&amp;gt;;
+clock-frequency = &amp;lt;100000&amp;gt;;
+interrupts = &amp;lt;15&amp;gt;;
+interrupt-parent = &amp;lt;&amp;amp;intc&amp;gt;;
+#address-cells = &amp;lt;1&amp;gt;;
+#size-cells = &amp;lt;0&amp;gt;;
+
+dtt&amp;lt; at &amp;gt;48 {
+compatible = "national,lm75";
+reg = &amp;lt;0x48&amp;gt;;
+};
+};
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index a76d85f..c1783bb 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -38,9 +38,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include &amp;lt;linux/slab.h&amp;gt;
 #include &amp;lt;linux/cpufreq.h&amp;gt;
 #include &amp;lt;linux/gpio.h&amp;gt;
+#include &amp;lt;linux/of_i2c.h&amp;gt;
+#include &amp;lt;linux/of_device.h&amp;gt;
 
 #include &amp;lt;mach/hardware.h&amp;gt;
 #include &amp;lt;mach/i2c.h&amp;gt;
+#include &amp;lt;mach/mux.h&amp;gt;
 
 /* ----- global defines ----------------------------------------------- */
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -635,6 +638,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static struct i2c_algorithm i2c_davinci_algo = {
 .functionality= i2c_davinci_func,
 };
 
+static const struct of_device_id davinci_i2c_of_match[] = {
+{.compatible = "ti,davinci-i2c", },
+{},
+};
+MODULE_DEVICE_TABLE(of, davinci_i2c_of_match);
+
 static int davinci_i2c_probe(struct platform_device *pdev)
 {
 struct davinci_i2c_dev *dev;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -676,6 +685,26 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int davinci_i2c_probe(struct platform_device *pdev)
 dev-&amp;gt;irq = irq-&amp;gt;start;
 platform_set_drvdata(pdev, dev);
 
+if ((dev-&amp;gt;dev-&amp;gt;platform_data == NULL) &amp;amp;&amp;amp;
+(pdev-&amp;gt;dev.of_node)) {
+struct davinci_i2c_platform_data *pdata;
+u32 prop;
+
+pdata = devm_kzalloc(&amp;amp;pdev-&amp;gt;dev, sizeof(*pdata), GFP_KERNEL);
+if (!pdata) {
+r = -ENOMEM;
+goto err_free_mem;
+}
+memcpy(pdata, &amp;amp;davinci_i2c_platform_data_default,
+sizeof(*pdata));
+dev-&amp;gt;dev-&amp;gt;platform_data = pdata;
+if (!of_property_read_u32(pdev-&amp;gt;dev.of_node, "clock-frequency",
+&amp;amp;prop))
+pdata-&amp;gt;bus_freq = prop / 1000;
+if (!of_property_read_u32(pdev-&amp;gt;dev.of_node, "bus-delay",
+&amp;amp;prop))
+pdata-&amp;gt;bus_delay = prop;
+}
 dev-&amp;gt;clk = clk_get(&amp;amp;pdev-&amp;gt;dev, NULL);
 if (IS_ERR(dev-&amp;gt;clk)) {
 r = -ENODEV;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -711,6 +740,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int davinci_i2c_probe(struct platform_device *pdev)
 adap-&amp;gt;algo = &amp;amp;i2c_davinci_algo;
 adap-&amp;gt;dev.parent = &amp;amp;pdev-&amp;gt;dev;
 adap-&amp;gt;timeout = DAVINCI_I2C_TIMEOUT;
+adap-&amp;gt;dev.of_node = pdev-&amp;gt;dev.of_node;
 
 adap-&amp;gt;nr = pdev-&amp;gt;id;
 r = i2c_add_numbered_adapter(adap);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -718,6 +748,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int davinci_i2c_probe(struct platform_device *pdev)
 dev_err(&amp;amp;pdev-&amp;gt;dev, "failure adding adapter\n");
 goto err_free_irq;
 }
+of_i2c_register_devices(adap);
 
 return 0;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -809,6 +840,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static struct platform_driver davinci_i2c_driver = {
 .name= "i2c_davinci",
 .owner= THIS_MODULE,
 .pm= davinci_i2c_pm_ops,
+.of_match_table = of_match_ptr(davinci_i2c_of_match),
 },
 };
 
&lt;/pre&gt;</description>
    <dc:creator>Heiko Schocher</dc:creator>
    <dc:date>2012-05-22T13:55:18</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11343">
    <title>Re: [PATCH V2 00/11] enable imx6q_sabrelite sgtl5000 audio support</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11343</link>
    <description>&lt;pre&gt;


There was mention of some changes but only a vauge description of them,
I've no idea where they are or anything, initially people had mentioned
an already cross-merged point in Linus' tree but apparently that wasn't
sufficient due to these arch specific bits and I don't know where those
are.

We should really have got this resolved in -next...



Well, a lot of the time there's no actual dependency (eg, you add a
driver and add registration of that device so there's no need for them
to go in together since both are perfectly fine without the other) then
it is best to merge things separately.  If there are dependencies then
that needs to be handled differently but it needs communication and
ideally the dependencies would be on focused things that can just be
pulled in.  

In the case of things like the devm_clk_get() cleanup if there's any
complexity at all then it's usually best just to punt for a release.
&lt;/pre&gt;</description>
    <dc:creator>Mark Brown</dc:creator>
    <dc:date>2012-05-22T09:56:35</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11341">
    <title>Re: [RFC v2 5/5] drm: Add NVIDIA Tegra support</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11341</link>
    <description>&lt;pre&gt;


Hi,

There is a reason for existence of bus_type in Linux kernel. It exposes
the various busses to developers, and give a framework for drivers to
work in. It just makes the drivers easier to develop, and makes the big
picture easier to understand.

The problem is that bus_type is cumbersome to implement, and most
implementations seem to duplicate significant amount of code from
platform bus. This is the problem that we should tackle.

If I manage to get the boilerplate code in nvhost for bus_type small
enough, that's the structure we should use. If bus_type is just
inherently fat and broken, I'll need to migrate nvhost away from it.

Terje
&lt;/pre&gt;</description>
    <dc:creator>Terje Bergström</dc:creator>
    <dc:date>2012-05-22T06:19:23</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11339">
    <title>RE: Howto compile py-smbus with python 3.2</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11339</link>
    <description>&lt;pre&gt;Hi Jean,

At the moment, I comment the Python2 code lines and add the Python3 ones. Below is the diff -ruNp output.
To get the code work for both platforms in one file, we have to make an if statement like if platform.python_version() &amp;gt;= 3.


--- smbusmodule.c       2012-05-14 17:47:22.606768184 +0200
+++ smbusmodule_org.c   2009-01-22 10:55:33.000000000 +0100
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -5,12 +5,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; version 2 of the License.
- *
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -32,7 +32,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #define I2C_SMBUS_I2C_BLOCK_DATA       8
 #endif

-/*yDoc_STRVAR(SMBus_module_doc,
+PyDoc_STRVAR(SMBus_module_doc,
        "This module defines an object type that allows SMBus transactions\n"
        "on hosts running the Linux kernel.  The host kernel must have I2C\n"
        "support, I2C device interface support, and a bus adapter driver.\n"
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -41,7 +41,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
        "\n"
        "Because the I2C device interface is opened R/W, users of this\n"
        "module usually must have root permissions.\n");
-*/

 typedef struct {
        PyObject_HEAD
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -92,9 +91,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; SMBus_dealloc(SMBus *self)
        PyObject *ref = SMBus_close(self);
        Py_XDECREF(ref);

-    /*old python 2.7 declaration */
-       /*self-&amp;gt;ob_type-&amp;gt;tp_free((PyObject *)self);*/
-       Py_TYPE(self)-&amp;gt;tp_free((PyObject*)self);
+       self-&amp;gt;ob_type-&amp;gt;tp_free((PyObject *)self);
 }

 #define MAXPATH 16
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -434,11 +431,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; SMBus_list_to_data(PyObject *list, union

        for (ii = 0; ii &amp;lt; len; ii++) {
                PyObject *val = PyList_GET_ITEM(list, ii);
-               if (!PyLong_Check(val)) {
+               if (!PyInt_Check(val)) {
                        PyErr_SetString(PyExc_TypeError, msg);
                        return 0; /* fail */
                }
-               data-&amp;gt;block[ii+1] = (__u8)PyLong_AS_LONG(val);
+               data-&amp;gt;block[ii+1] = (__u8)PyInt_AS_LONG(val);
        }

        return 1; /* success */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -614,7 +611,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; SMBus_set_pec(SMBus *self, PyObject *val
                return -1;
        }
        else if (pec == -1) {
-               PyErr_SetString(PyExc_TypeError,
+               PyErr_SetString(PyExc_TypeError,
                        "The pec attribute must be a boolean.");
                return -1;
        }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -636,16 +633,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static PyGetSetDef SMBus_getset[] = {
        {NULL},
 };

-/* old Python 2.7 declaration */
 static PyTypeObject SMBus_type = {
-/*tatic struct PyModuleDef SMBus_type = {*/
-    /* old Python 2.7 declaration */
-       /* PyObject_HEAD_INIT(NULL) */
-       /*0,                             ob_size */
-       PyVarObject_HEAD_INIT(NULL, 0)
+       PyObject_HEAD_INIT(NULL)
+       0,                              /* ob_size */
        "SMBus",                        /* tp_name */
-       sizeof(SMBus),          /* tp_basicsize */
-       0,                                  /* tp_itemsize */
+       sizeof(SMBus),                  /* tp_basicsize */
+       0,                              /* tp_itemsize */
        (destructor)SMBus_dealloc,      /* tp_dealloc */
        0,                              /* tp_print */
        0,                              /* tp_getattr */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -661,71 +654,45 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static PyTypeObject SMBus_type = {
        0,                              /* tp_getattro */
        0,                              /* tp_setattro */
        0,                              /* tp_as_buffer */
-       Py_TPFLAGS_DEFAULT, /* tp_flags */
-       SMBus_type_doc,         /* tp_doc */
+       Py_TPFLAGS_DEFAULT,             /* tp_flags */
+       SMBus_type_doc,                 /* tp_doc */
        0,                              /* tp_traverse */
        0,                              /* tp_clear */
        0,                              /* tp_richcompare */
        0,                              /* tp_weaklistoffset */
        0,                              /* tp_iter */
        0,                              /* tp_iternext */
-       SMBus_methods,  /* tp_methods */
-       0,              /* tp_members */
-       SMBus_getset,   /* tp_getset */
+       SMBus_methods,                  /* tp_methods */
+       0,                              /* tp_members */
+       SMBus_getset,                   /* tp_getset */
        0,                              /* tp_base */
        0,                              /* tp_dict */
        0,                              /* tp_descr_get */
        0,                              /* tp_descr_set */
        0,                              /* tp_dictoffset */
-       (initproc)SMBus_init,   /* tp_init */
+       (initproc)SMBus_init,           /* tp_init */
        0,                              /* tp_alloc */
-       SMBus_new,              /* tp_new */
+       SMBus_new,                      /* tp_new */
 };

-/*static PyMethodDef SMBus_module_methods[] = {
+static PyMethodDef SMBus_module_methods[] = {
        {NULL}
-};*/
-
-static struct PyModuleDef SMBusModule = {
-        PyModuleDef_HEAD_INIT,
-        "SMBus",     /* m_name */
-        "This module defines an object type that allows SMBus transactions\n"
-           "on hosts running the Linux kernel.  The host kernel must have I2C\n"
-           "support, I2C device interface support, and a bus adapter driver.\n"
-           "All of these can be either built-in to the kernel, or loaded from\n"
-           "modules.\n"
-           "\n"
-           "Because the I2C device interface is opened R/W, users of this\n"
-           "module usually must have root permissions.\n",  /* m_doc */
-        -1,                  /* m_size */
-        NULL,    /* m_methods */
-        NULL,                /* m_reload */
-        NULL,                /* m_traverse */
-        NULL,                /* m_clear */
-        NULL,                /* m_free */
-    };
+};

 #ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
 #define PyMODINIT_FUNC void
 #endif
 PyMODINIT_FUNC
-PyInit_smbus(void)
+initsmbus(void)
 {
        PyObject* m;

-    if (PyType_Ready(&amp;amp;SMBus_type) &amp;lt; 0)
-               return NULL;
+       if (PyType_Ready(&amp;amp;SMBus_type) &amp;lt; 0)
+               return;

-    /* old Python 2.7 declaration */
-       /*m = Py_InitModule3("smbus", SMBus_module_methods, SMBus_module_doc);*/
-       m = PyModule_Create(&amp;amp;SMBusModule);
-
-    if (m == NULL)
-        return NULL;
+       m = Py_InitModule3("smbus", SMBus_module_methods, SMBus_module_doc);

        Py_INCREF(&amp;amp;SMBus_type);
        PyModule_AddObject(m, "SMBus", (PyObject *)&amp;amp;SMBus_type);
-
-       return m;
 }

-----Original Message-----
From: Jean Delvare [mailto:khali-PUYAD+kWke1g9hUCZPvPmw&amp;lt; at &amp;gt;public.gmane.org]
Sent: Monday, 21 May, 2012 17:14
To: Renz, Bernhard
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA&amp;lt; at &amp;gt;public.gmane.org
Subject: Re: Howto compile py-smbus with python 3.2

Hi Bernhard,

On Mon, 21 May 2012 15:10:38 +0000, Renz, Bernhard wrote:

I'll do if you provide your changes as a patch (use diff -ruNp). BTW I hope that your changes do not break support for python version 2, a lot of distributions are still shipping that so we can't break it.

Thanks,
--
Jean Delvare

________________________________
The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.

&lt;/pre&gt;</description>
    <dc:creator>Renz, Bernhard</dc:creator>
    <dc:date>2012-05-21T15:40:07</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11338">
    <title>Re: Howto compile py-smbus with python 3.2</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11338</link>
    <description>&lt;pre&gt;Hi Bernhard,

On Mon, 21 May 2012 15:10:38 +0000, Renz, Bernhard wrote:

I'll do if you provide your changes as a patch (use diff -ruNp). BTW I
hope that your changes do not break support for python version 2, a lot
of distributions are still shipping that so we can't break it.

Thanks,
&lt;/pre&gt;</description>
    <dc:creator>Jean Delvare</dc:creator>
    <dc:date>2012-05-21T15:14:19</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11337">
    <title>RE: Howto compile py-smbus with python 3.2</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11337</link>
    <description>&lt;pre&gt;Hello,

I got it to work!
With the following pages I did a conversion of py-smbus from Python2 to Python3:
http://docs.python.org/release/3.1.5/extending/building.html#building
http://python3porting.com/cextensions.html

Here is the smbusmodule.c, which is based on the i2c-tools-3.1.0 release, which compile with Python3:
Hope maybe Khali can provide it for other developers on his repository....


/*
 * smbusmodule.c - Python bindings for Linux SMBus access through i2c-dev
 * Copyright (C) 2005-2007 Mark M. Hoffman &amp;lt;mhoffman-xQSgfq/1h4JiLUuM0BA3LQ&amp;lt; at &amp;gt;public.gmane.org&amp;gt;
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#include &amp;lt;Python.h&amp;gt;
#include "structmember.h"
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;fcntl.h&amp;gt;
#include &amp;lt;linux/i2c-dev.h&amp;gt;

/*
** These are required to build this module against Linux older than 2.6.23.
*/
#ifndef I2C_SMBUS_I2C_BLOCK_BROKEN
#undef I2C_SMBUS_I2C_BLOCK_DATA
#define I2C_SMBUS_I2C_BLOCK_BROKEN6
#define I2C_SMBUS_I2C_BLOCK_DATA8
#endif

/*yDoc_STRVAR(SMBus_module_doc,
"This module defines an object type that allows SMBus transactions\n"
"on hosts running the Linux kernel.  The host kernel must have I2C\n"
"support, I2C device interface support, and a bus adapter driver.\n"
"All of these can be either built-in to the kernel, or loaded from\n"
"modules.\n"
"\n"
"Because the I2C device interface is opened R/W, users of this\n"
"module usually must have root permissions.\n");
*/

typedef struct {
PyObject_HEAD

int fd;/* open file descriptor: /dev/i2c-?, or -1 */
int addr;/* current client SMBus address */
int pec;/* !0 =&amp;gt; Packet Error Codes enabled */
} SMBus;

static PyObject *
SMBus_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
SMBus *self;

if ((self = (SMBus *)type-&amp;gt;tp_alloc(type, 0)) == NULL)
return NULL;

self-&amp;gt;fd = -1;
self-&amp;gt;addr = -1;
self-&amp;gt;pec = 0;

return (PyObject *)self;
}

PyDoc_STRVAR(SMBus_close_doc,
"close()\n\n"
"Disconnects the object from the bus.\n");

static PyObject *
SMBus_close(SMBus *self)
{
if ((self-&amp;gt;fd != -1) &amp;amp;&amp;amp; (close(self-&amp;gt;fd) == -1)) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

self-&amp;gt;fd = -1;
self-&amp;gt;addr = -1;
self-&amp;gt;pec = 0;

Py_INCREF(Py_None);
return Py_None;
}

static void
SMBus_dealloc(SMBus *self)
{
PyObject *ref = SMBus_close(self);
Py_XDECREF(ref);

    /*old python 2.7 declaration */
/*self-&amp;gt;ob_type-&amp;gt;tp_free((PyObject *)self);*/
Py_TYPE(self)-&amp;gt;tp_free((PyObject*)self);
}

#define MAXPATH 16

PyDoc_STRVAR(SMBus_open_doc,
"open(bus)\n\n"
"Connects the object to the specified SMBus.\n");

static PyObject *
SMBus_open(SMBus *self, PyObject *args, PyObject *kwds)
{
int bus;
char path[MAXPATH];

static char *kwlist[] = {"bus", NULL};

if (!PyArg_ParseTupleAndKeywords(args, kwds, "i:open", kwlist, &amp;amp;bus))
return NULL;

if (snprintf(path, MAXPATH, "/dev/i2c-%d", bus) &amp;gt;= MAXPATH) {
PyErr_SetString(PyExc_OverflowError,
"Bus number is invalid.");
return NULL;
}

if ((self-&amp;gt;fd = open(path, O_RDWR, 0)) == -1) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

Py_INCREF(Py_None);
return Py_None;
}

static int
SMBus_init(SMBus *self, PyObject *args, PyObject *kwds)
{
int bus = -1;

static char *kwlist[] = {"bus", NULL};

if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i:__init__",
kwlist, &amp;amp;bus))
return -1;

if (bus &amp;gt;= 0) {
SMBus_open(self, args, kwds);
if (PyErr_Occurred())
return -1;
}

return 0;
}

/*
 * private helper function, 0 =&amp;gt; success, !0 =&amp;gt; error
 */
static int
SMBus_set_addr(SMBus *self, int addr)
{
int ret = 0;

if (self-&amp;gt;addr != addr) {
ret = ioctl(self-&amp;gt;fd, I2C_SLAVE, addr);
self-&amp;gt;addr = addr;
}

return ret;
}

#define SMBus_SET_ADDR(self, addr) do { \
if (SMBus_set_addr(self, addr)) { \
PyErr_SetFromErrno(PyExc_IOError); \
return NULL; \
} \
} while(0)

PyDoc_STRVAR(SMBus_write_quick_doc,
"write_quick(addr)\n\n"
"Perform SMBus Quick transaction.\n");

static PyObject *
SMBus_write_quick(SMBus *self, PyObject *args)
{
int addr;
__s32 result;

if (!PyArg_ParseTuple(args, "i:write_quick", &amp;amp;addr))
return NULL;

SMBus_SET_ADDR(self, addr);

if ((result = i2c_smbus_write_quick(self-&amp;gt;fd, I2C_SMBUS_WRITE))) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

Py_INCREF(Py_None);
return Py_None;
}

PyDoc_STRVAR(SMBus_read_byte_doc,
"read_byte(addr) -&amp;gt; result\n\n"
"Perform SMBus Read Byte transaction.\n");

static PyObject *
SMBus_read_byte(SMBus *self, PyObject *args)
{
int addr;
__s32 result;

if (!PyArg_ParseTuple(args, "i:read_byte", &amp;amp;addr))
return NULL;

SMBus_SET_ADDR(self, addr);

if ((result = i2c_smbus_read_byte(self-&amp;gt;fd)) == -1) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

return Py_BuildValue("l", (long)result);
}

PyDoc_STRVAR(SMBus_write_byte_doc,
"write_byte(addr, val)\n\n"
"Perform SMBus Write Byte transaction.\n");

static PyObject *
SMBus_write_byte(SMBus *self, PyObject *args)
{
int addr, val;
__s32 result;

if (!PyArg_ParseTuple(args, "ii:write_byte", &amp;amp;addr, &amp;amp;val))
return NULL;

SMBus_SET_ADDR(self, addr);

if ((result = i2c_smbus_write_byte(self-&amp;gt;fd, (__u8)val)) == -1) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

Py_INCREF(Py_None);
return Py_None;
}

PyDoc_STRVAR(SMBus_read_byte_data_doc,
"read_byte_data(addr, cmd) -&amp;gt; result\n\n"
"Perform SMBus Read Byte Data transaction.\n");

static PyObject *
SMBus_read_byte_data(SMBus *self, PyObject *args)
{
int addr, cmd;
__s32 result;

if (!PyArg_ParseTuple(args, "ii:read_byte_data", &amp;amp;addr, &amp;amp;cmd))
return NULL;

SMBus_SET_ADDR(self, addr);

if ((result = i2c_smbus_read_byte_data(self-&amp;gt;fd, (__u8)cmd)) == -1) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

return Py_BuildValue("l", (long)result);
}

PyDoc_STRVAR(SMBus_write_byte_data_doc,
"write_byte_data(addr, cmd, val)\n\n"
"Perform SMBus Write Byte Data transaction.\n");

static PyObject *
SMBus_write_byte_data(SMBus *self, PyObject *args)
{
int addr, cmd, val;
__s32 result;

if (!PyArg_ParseTuple(args, "iii:write_byte_data", &amp;amp;addr, &amp;amp;cmd, &amp;amp;val))
return NULL;

SMBus_SET_ADDR(self, addr);

if ((result = i2c_smbus_write_byte_data(self-&amp;gt;fd,
(__u8)cmd, (__u8)val)) == -1) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

Py_INCREF(Py_None);
return Py_None;
}

PyDoc_STRVAR(SMBus_read_word_data_doc,
"read_word_data(addr, cmd) -&amp;gt; result\n\n"
"Perform SMBus Read Word Data transaction.\n");

static PyObject *
SMBus_read_word_data(SMBus *self, PyObject *args)
{
int addr, cmd;
__s32 result;

if (!PyArg_ParseTuple(args, "ii:read_word_data", &amp;amp;addr, &amp;amp;cmd))
return NULL;

SMBus_SET_ADDR(self, addr);

if ((result = i2c_smbus_read_word_data(self-&amp;gt;fd, (__u8)cmd)) == -1) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

return Py_BuildValue("l", (long)result);
}

PyDoc_STRVAR(SMBus_write_word_data_doc,
"write_word_data(addr, cmd, val)\n\n"
"Perform SMBus Write Word Data transaction.\n");

static PyObject *
SMBus_write_word_data(SMBus *self, PyObject *args)
{
int addr, cmd, val;
__s32 result;

if (!PyArg_ParseTuple(args, "iii:write_word_data", &amp;amp;addr, &amp;amp;cmd, &amp;amp;val))
return NULL;

SMBus_SET_ADDR(self, addr);

if ((result = i2c_smbus_write_word_data(self-&amp;gt;fd,
(__u8)cmd, (__u16)val)) == -1) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

Py_INCREF(Py_None);
return Py_None;
}

PyDoc_STRVAR(SMBus_process_call_doc,
"process_call(addr, cmd, val)\n\n"
"Perform SMBus Process Call transaction.\n");

static PyObject *
SMBus_process_call(SMBus *self, PyObject *args)
{
int addr, cmd, val;
__s32 result;

if (!PyArg_ParseTuple(args, "iii:process_call", &amp;amp;addr, &amp;amp;cmd, &amp;amp;val))
return NULL;

SMBus_SET_ADDR(self, addr);

if ((result = i2c_smbus_process_call(self-&amp;gt;fd,
(__u8)cmd, (__u16)val)) == -1) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

Py_INCREF(Py_None);
return Py_None;
}

/*
 * private helper function; returns a new list of integers
 */
static PyObject *
SMBus_buf_to_list(__u8 const *buf, int len)
{
PyObject *list = PyList_New(len);
int ii;

if (list == NULL)
return NULL;

for (ii = 0; ii &amp;lt; len; ii++) {
PyObject *val = Py_BuildValue("l", (long)buf[ii]);
PyList_SET_ITEM(list, ii, val);
}
return list;
}

PyDoc_STRVAR(SMBus_read_block_data_doc,
"read_block_data(addr, cmd) -&amp;gt; results\n\n"
"Perform SMBus Read Block Data transaction.\n");

static PyObject *
SMBus_read_block_data(SMBus *self, PyObject *args)
{
int addr, cmd;
union i2c_smbus_data data;

if (!PyArg_ParseTuple(args, "ii:read_block_data", &amp;amp;addr, &amp;amp;cmd))
return NULL;

SMBus_SET_ADDR(self, addr);

/* save a bit of code by calling the access function directly */
if (i2c_smbus_access(self-&amp;gt;fd, I2C_SMBUS_READ, (__u8)cmd,
I2C_SMBUS_BLOCK_DATA, &amp;amp;data)) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

/* first byte of the block contains (remaining) data length */
return SMBus_buf_to_list(&amp;amp;data.block[1], data.block[0]);
}

/*
 * private helper function: convert an integer list to union i2c_smbus_data
 */
static int
SMBus_list_to_data(PyObject *list, union i2c_smbus_data *data)
{
static char *msg = "Third argument must be a list of at least one, "
"but not more than 32 integers";
int ii, len;

if (!PyList_Check(list)) {
PyErr_SetString(PyExc_TypeError, msg);
return 0; /* fail */
}

if ((len = PyList_GET_SIZE(list)) &amp;gt; 32) {
PyErr_SetString(PyExc_OverflowError, msg);
return 0; /* fail */
}

/* first byte is the length */
data-&amp;gt;block[0] = (__u8)len;

for (ii = 0; ii &amp;lt; len; ii++) {
PyObject *val = PyList_GET_ITEM(list, ii);
if (!PyLong_Check(val)) {
PyErr_SetString(PyExc_TypeError, msg);
return 0; /* fail */
}
data-&amp;gt;block[ii+1] = (__u8)PyLong_AS_LONG(val);
}

return 1; /* success */
}

PyDoc_STRVAR(SMBus_write_block_data_doc,
"write_block_data(addr, cmd, [vals])\n\n"
"Perform SMBus Write Block Data transaction.\n");

static PyObject *
SMBus_write_block_data(SMBus *self, PyObject *args)
{
int addr, cmd;
union i2c_smbus_data data;

if (!PyArg_ParseTuple(args, "iiO&amp;amp;:write_block_data", &amp;amp;addr, &amp;amp;cmd,
SMBus_list_to_data, &amp;amp;data))
return NULL;

SMBus_SET_ADDR(self, addr);

/* save a bit of code by calling the access function directly */
if (i2c_smbus_access(self-&amp;gt;fd, I2C_SMBUS_WRITE, (__u8)cmd,
I2C_SMBUS_BLOCK_DATA, &amp;amp;data)) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

Py_INCREF(Py_None);
return Py_None;
}

PyDoc_STRVAR(SMBus_block_process_call_doc,
"block_process_call(addr, cmd, [vals]) -&amp;gt; results\n\n"
"Perform SMBus Block Process Call transaction.\n");

static PyObject *
SMBus_block_process_call(SMBus *self, PyObject *args)
{
int addr, cmd;
union i2c_smbus_data data;

if (!PyArg_ParseTuple(args, "iiO&amp;amp;:block_process_call", &amp;amp;addr, &amp;amp;cmd,
SMBus_list_to_data, &amp;amp;data))
return NULL;

SMBus_SET_ADDR(self, addr);

/* save a bit of code by calling the access function directly */
if (i2c_smbus_access(self-&amp;gt;fd, I2C_SMBUS_WRITE, (__u8)cmd,
I2C_SMBUS_BLOCK_PROC_CALL, &amp;amp;data)) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

/* first byte of the block contains (remaining) data length */
return SMBus_buf_to_list(&amp;amp;data.block[1], data.block[0]);
}

PyDoc_STRVAR(SMBus_read_i2c_block_data_doc,
"read_i2c_block_data(addr, cmd, len=32) -&amp;gt; results\n\n"
"Perform I2C Block Read transaction.\n");

static PyObject *
SMBus_read_i2c_block_data(SMBus *self, PyObject *args)
{
int addr, cmd, len=32;
union i2c_smbus_data data;

if (!PyArg_ParseTuple(args, "ii|i:read_i2c_block_data", &amp;amp;addr, &amp;amp;cmd,
&amp;amp;len))
return NULL;

SMBus_SET_ADDR(self, addr);

data.block[0] = len;
/* save a bit of code by calling the access function directly */
if (i2c_smbus_access(self-&amp;gt;fd, I2C_SMBUS_READ, (__u8)cmd,
len == 32 ? I2C_SMBUS_I2C_BLOCK_BROKEN:
I2C_SMBUS_I2C_BLOCK_DATA, &amp;amp;data)) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

/* first byte of the block contains (remaining) data length */
return SMBus_buf_to_list(&amp;amp;data.block[1], data.block[0]);
}

PyDoc_STRVAR(SMBus_write_i2c_block_data_doc,
"write_i2c_block_data(addr, cmd, [vals])\n\n"
"Perform I2C Block Write transaction.\n");

static PyObject *
SMBus_write_i2c_block_data(SMBus *self, PyObject *args)
{
int addr, cmd;
union i2c_smbus_data data;

if (!PyArg_ParseTuple(args, "iiO&amp;amp;:write_i2c_block_data", &amp;amp;addr, &amp;amp;cmd,
SMBus_list_to_data, &amp;amp;data))
return NULL;

SMBus_SET_ADDR(self, addr);

/* save a bit of code by calling the access function directly */
if (i2c_smbus_access(self-&amp;gt;fd, I2C_SMBUS_WRITE, (__u8)cmd,
I2C_SMBUS_I2C_BLOCK_BROKEN, &amp;amp;data)) {
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}

Py_INCREF(Py_None);
return Py_None;
}

PyDoc_STRVAR(SMBus_type_doc,
"SMBus([bus]) -&amp;gt; SMBus\n\n"
"Return a new SMBus object that is (optionally) connected to the\n"
"specified I2C device interface.\n");

static PyMethodDef SMBus_methods[] = {
{"open", (PyCFunction)SMBus_open, METH_VARARGS | METH_KEYWORDS,
SMBus_open_doc},
{"close", (PyCFunction)SMBus_close, METH_NOARGS,
SMBus_close_doc},
{"write_quick", (PyCFunction)SMBus_write_quick, METH_VARARGS,
SMBus_write_quick_doc},
{"read_byte", (PyCFunction)SMBus_read_byte, METH_VARARGS,
SMBus_read_byte_doc},
{"write_byte", (PyCFunction)SMBus_write_byte, METH_VARARGS,
SMBus_write_byte_doc},
{"read_byte_data", (PyCFunction)SMBus_read_byte_data, METH_VARARGS,
SMBus_read_byte_data_doc},
{"write_byte_data", (PyCFunction)SMBus_write_byte_data, METH_VARARGS,
SMBus_write_byte_data_doc},
{"read_word_data", (PyCFunction)SMBus_read_word_data, METH_VARARGS,
SMBus_read_word_data_doc},
{"write_word_data", (PyCFunction)SMBus_write_word_data, METH_VARARGS,
SMBus_write_word_data_doc},
{"process_call", (PyCFunction)SMBus_process_call, METH_VARARGS,
SMBus_process_call_doc},
{"read_block_data", (PyCFunction)SMBus_read_block_data, METH_VARARGS,
SMBus_read_block_data_doc},
{"write_block_data", (PyCFunction)SMBus_write_block_data, METH_VARARGS,
SMBus_write_block_data_doc},
{"block_process_call", (PyCFunction)SMBus_block_process_call,
METH_VARARGS, SMBus_block_process_call_doc},
{"read_i2c_block_data", (PyCFunction)SMBus_read_i2c_block_data,
METH_VARARGS, SMBus_read_i2c_block_data_doc},
{"write_i2c_block_data", (PyCFunction)SMBus_write_i2c_block_data,
METH_VARARGS, SMBus_write_i2c_block_data_doc},
{NULL},
};

static PyObject *
SMBus_get_pec(SMBus *self, void *closure)
{
PyObject *result = self-&amp;gt;pec ? Py_True : Py_False;
Py_INCREF(result);
return result;
}

static int
SMBus_set_pec(SMBus *self, PyObject *val, void *closure)
{
int pec;

pec = PyObject_IsTrue(val);

if (val == NULL) {
PyErr_SetString(PyExc_TypeError,
"Cannot delete attribute");
return -1;
}
else if (pec == -1) {
PyErr_SetString(PyExc_TypeError,
"The pec attribute must be a boolean.");
return -1;
}

if (self-&amp;gt;pec != pec) {
if (ioctl(self-&amp;gt;fd, I2C_PEC, pec)) {
PyErr_SetFromErrno(PyExc_IOError);
return -1;
}
self-&amp;gt;pec = pec;
}

return 0;
}

static PyGetSetDef SMBus_getset[] = {
{"pec", (getter)SMBus_get_pec, (setter)SMBus_set_pec,
"True if Packet Error Codes (PEC) are enabled"},
{NULL},
};

/* old Python 2.7 declaration */
static PyTypeObject SMBus_type = {
/*tatic struct PyModuleDef SMBus_type = {*/
    /* old Python 2.7 declaration */
/* PyObject_HEAD_INIT(NULL) */
/*0, ob_size */
PyVarObject_HEAD_INIT(NULL, 0)
"SMBus",/* tp_name */
sizeof(SMBus),/* tp_basicsize */
0,    /* tp_itemsize */
(destructor)SMBus_dealloc,/* tp_dealloc */
0,/* tp_print */
0,/* tp_getattr */
0,/* tp_setattr */
0,/* tp_compare */
0,/* tp_repr */
0,/* tp_as_number */
0,/* tp_as_sequence */
0,/* tp_as_mapping */
0,/* tp_hash */
0,/* tp_call */
0,/* tp_str */
0,/* tp_getattro */
0,/* tp_setattro */
0,/* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
SMBus_type_doc,/* tp_doc */
0,/* tp_traverse */
0,/* tp_clear */
0,/* tp_richcompare */
0,/* tp_weaklistoffset */
0,/* tp_iter */
0,/* tp_iternext */
SMBus_methods,/* tp_methods */
0,              /* tp_members */
SMBus_getset,/* tp_getset */
0,/* tp_base */
0,/* tp_dict */
0,/* tp_descr_get */
0,/* tp_descr_set */
0,/* tp_dictoffset */
(initproc)SMBus_init,   /* tp_init */
0,/* tp_alloc */
SMBus_new,/* tp_new */
};

/*static PyMethodDef SMBus_module_methods[] = {
{NULL}
};*/

static struct PyModuleDef SMBusModule = {
        PyModuleDef_HEAD_INIT,
        "SMBus",     /* m_name */
        "This module defines an object type that allows SMBus transactions\n"
    "on hosts running the Linux kernel.  The host kernel must have I2C\n"
    "support, I2C device interface support, and a bus adapter driver.\n"
    "All of these can be either built-in to the kernel, or loaded from\n"
    "modules.\n"
    "\n"
    "Because the I2C device interface is opened R/W, users of this\n"
    "module usually must have root permissions.\n",  /* m_doc */
        -1,                  /* m_size */
        NULL,    /* m_methods */
        NULL,                /* m_reload */
        NULL,                /* m_traverse */
        NULL,                /* m_clear */
        NULL,                /* m_free */
    };

#ifndef PyMODINIT_FUNC/* declarations for DLL import/export */
#define PyMODINIT_FUNC void
#endif
PyMODINIT_FUNC
PyInit_smbus(void)
{
PyObject* m;

    if (PyType_Ready(&amp;amp;SMBus_type) &amp;lt; 0)
return NULL;

    /* old Python 2.7 declaration */
/*m = Py_InitModule3("smbus", SMBus_module_methods, SMBus_module_doc);*/
m = PyModule_Create(&amp;amp;SMBusModule);

    if (m == NULL)
        return NULL;

Py_INCREF(&amp;amp;SMBus_type);
PyModule_AddObject(m, "SMBus", (PyObject *)&amp;amp;SMBus_type);

return m;
}




-----Original Message-----
From: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA&amp;lt; at &amp;gt;public.gmane.org [mailto:linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA&amp;lt; at &amp;gt;public.gmane.org] On Behalf Of Renz, Bernhard
Sent: Monday, 14 May, 2012 13:16
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA&amp;lt; at &amp;gt;public.gmane.org
Subject: Howto compile py-smbus with python 3.2

Hello &amp;lt; at &amp;gt;All,

i try to compile i2c-tools-3.1.0 py-smbus, smbusmodule.c with the following command under Ubuntu 12.04:
python3.2 ./setup.py build

But it fail with the following errors:
running build
running build_ext
building 'smbus' extension
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -I/usr/include/python3.2mu -c smbusmodule.c -o build/temp.linux-x86_64-3.2/smbusmodule.o



smbusmodule.c: In function 'SMBus_dealloc':
smbusmodule.c:94:6: error: 'SMBus' has no member named 'ob_type'
smbusmodule.c: In function 'SMBus_list_to_data':

With Python 2.7 it works. So it seems that the smbusmodule.c is written for Python 2.7.
I googled a bit, and found the following article where the changes in the c extentation between Python 2.X and Python 3 is described (espancially the ob_type problem):
http://python3porting.com/cextensions.html

Citation:
Another change in the object header is that the PyObject_HEAD macro has changed so that ob_type is now in a nested structure. This means you no longer can pick the ob_type directly from the struct, so code like ob-&amp;gt;ob_type stops working. You should replace this with Py_TYPE(ob). The Py_TYPE macro doesn't appear until Python 2.6, so to support earlier versions we make another #ifndef:
#ifndef Py_TYPE
    #define Py_TYPE(ob) (((PyObject*)(ob))-&amp;gt;ob_type) #endif In both cases the definitions above are taken directly from the Python 2.6 headers, where they are defined for forward compatibility purposes with Python 3. They work well in earlier Python versions as well, so this is a trick you can use as a general rule; if you need to use a macro that is defined in Python 3 and Python 2.6, just steal the Python 2.6 or Python 2.7 definition and put it inside an #ifndef.


Has anybody smbusmodule.c port to use with python 3?

With kind regards
Bernhard


________________________________
The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA&amp;lt; at &amp;gt;public.gmane.org More majordomo info at  http://vger.kernel.org/majordomo-info.html

&lt;/pre&gt;</description>
    <dc:creator>Renz, Bernhard</dc:creator>
    <dc:date>2012-05-21T15:10:38</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11336">
    <title>Re: [PATCH V2 00/11] enable imx6q_sabrelite sgtl5000 audio support</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11336</link>
    <description>&lt;pre&gt;


No, apart from anything else the second patch depends on clkdev which is
nothing to do with pinctrl!  For the first patch it wasn't clear if the
changes in pinctrl were the actual dependencies or if there were more
things needed from the ARM tree, and in any case until those patches are
actually in the ASoC tree we'll break the build if they get applied.

Guys, you really need to think about how you're organising what you're
doing more.  You need to split your work out into focused lines of
development rather than just having a single branch.  

This patch series contains a whole bunch of different changes (the
devm_clk_get() change is as far as I can tell completely unrelated to
the rest for example) with unclear dependencies on multiple external
trees.  You should be splitting unrelated changes out, trying to
minimise interdependencies, and clearly identifying the dependencies
that are there we can get things applied in a timely fashion.

Please resend these patches *after* their dependencies are in mainline.
&lt;/pre&gt;</description>
    <dc:creator>Mark Brown</dc:creator>
    <dc:date>2012-05-21T14:45:44</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11334">
    <title>Re: [PATCH V2 00/11] enable imx6q_sabrelite sgtl5000 audio support</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11334</link>
    <description>&lt;pre&gt;Hi Mark,

Linus has sent out pull request for pinctrl. So is that ok for you
to pick up the above two patch?

Thanks
Richard

&lt;/pre&gt;</description>
    <dc:creator>Richard Zhao</dc:creator>
    <dc:date>2012-05-21T12:59:31</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11330">
    <title>Re: identify i2c</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11330</link>
    <description>&lt;pre&gt;
You run "make menuconfig" then type /EEPROM_LEGACY&amp;lt;Enter&amp;gt;, it will tell
you where it is.


&lt;/pre&gt;</description>
    <dc:creator>Jean Delvare</dc:creator>
    <dc:date>2012-05-21T05:57:19</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11329">
    <title>Re: identify i2c</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11329</link>
    <description>&lt;pre&gt;
How do I find CONFIG_EEPROM_LEGACY in menuconfig?
I manually changed it in .config :-)
&lt;/pre&gt;</description>
    <dc:creator>James</dc:creator>
    <dc:date>2012-05-20T21:17:14</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11328">
    <title>Re: identify i2c</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11328</link>
    <description>&lt;pre&gt;
CONFIG_I2C=y
CONFIG_EEPROM_LEGACY=m

Plus CONFIG_I2C_&amp;lt;your I2C bus driver&amp;gt;=m. "lspci | grep SMBus" etc. might
tell you which it is.

&lt;/pre&gt;</description>
    <dc:creator>Jean Delvare</dc:creator>
    <dc:date>2012-05-20T21:00:47</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.linux.drivers.i2c/11327">
    <title>Re: [PATCH 01/18] i2c: Add Device Tree support to the Nomadik I2C driver</title>
    <link>http://permalink.gmane.org/gmane.linux.drivers.i2c/11327</link>
    <description>&lt;pre&gt;

Nice!
Acked-by: Linus Walleij &amp;lt;linus.walleij-QSEj5FYQhm4dnm+yROfE0A&amp;lt; at &amp;gt;public.gmane.org&amp;gt;

BTW: you want to CC Wolfram on the I2C patches.

Yours,
Linus Walleij
&lt;/pre&gt;</description>
    <dc:creator>Linus Walleij</dc:creator>
    <dc:date>2012-05-20T20:53:41</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.linux.drivers.i2c">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.linux.drivers.i2c</link>
  </textinput>
</rdf:RDF>

