Project

General

Profile

I2C 0x8 Address

Added by Angelos Spanos over 9 years ago

Hi All,

When I run i2cdetect -y 1 I get the following output:

0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- 08 -- -- -- UU -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
50: UU 51 52 53 54 55 56 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Could you please tell me what does the 0x0008 address refers to?

Kind Regards,

Angelos


Replies (37)

RE: I2C 0x8 Address - Added by Mostafa Afgani over 9 years ago

Yes, it is:

$ git status 
# On branch mitydsp-linux-v3.2_i2c_wip
nothing to commit (working directory clean)

$ make -j4 ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- mrproper
$ make -j4 ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- industrialio_defconfig
$ make -j4 ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig (for RNDIS built-in)
$ make -j4 ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage

Then copy the uImage to the Mity and:

# flashcp -v uImage /dev/mtd7 
Erasing blocks: 39/39 (100%)
Writing data: 2485k/0k (100%))
Verifying data: 2485k/0k (100%))

# reboot

After the reboot with v3.2_i2c_wip:

# echo 456000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
# echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

(hung...)

RE: I2C 0x8 Address - Added by Mostafa Afgani over 9 years ago

Just for clarification, I had reverted all changes to the branch (enabling i2c-2) so 'git status' shows no local modifications.

RE: I2C 0x8 Address - Added by Mostafa Afgani over 9 years ago

I've just tried the latest mitydsp-linux-v3.2 from git (without the i2c patches) and that works fine.

RE: I2C 0x8 Address - Added by Jonathan Cormier over 9 years ago

Are you saying you run into the hang when only i2c-1 is enabled?

RE: I2C 0x8 Address - Added by Mostafa Afgani over 9 years ago

Yes, v3.2_i2c_wip checked out and compiled as-is.

RE: I2C 0x8 Address - Added by Jonathan Cormier over 9 years ago

I'm not seeing this hang with or without i2c-2 enabled.

RE: I2C 0x8 Address - Added by Mostafa Afgani over 9 years ago

Really don't know why we're seeing different things. I checked out both 'mitydsp-linux-v3.2' and 'mitydsp-linux-v3.2_i2c_wip' from Git and compiled both as-is (after running mrproper and industrialio_defconfig). After running mrproper on both trees, a diff between the two shows:

diff -uNr v3.2/arch/arm/mach-davinci/cpufreq.c v3.2_i2c_wip/arch/arm/mach-davinci/cpufreq.c
--- v3.2/arch/arm/mach-davinci/cpufreq.c        2014-06-24 18:04:43.000000000 +0100
+++ v3.2_i2c_wip/arch/arm/mach-davinci/cpufreq.c        2014-07-29 16:50:04.000000000 +0100
@@ -102,8 +102,6 @@
        if (ret)
                return -EINVAL;

-       cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
-
        /* if moving to higher frequency, up the voltage beforehand */
        if (pdata->set_voltage && freqs.new > freqs.old) {
                ret = pdata->set_voltage(idx);
@@ -111,6 +109,8 @@
                        goto out;
        }

+       cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
+
        ret = clk_set_rate(armclk, idx);
        if (ret)
                goto out;
diff -uNr v3.2/drivers/i2c/busses/i2c-davinci.c v3.2_i2c_wip/drivers/i2c/busses/i2c-davinci.c
--- v3.2/drivers/i2c/busses/i2c-davinci.c       2014-06-24 18:04:43.000000000 +0100
+++ v3.2_i2c_wip/drivers/i2c/busses/i2c-davinci.c       2014-07-29 16:50:04.000000000 +0100
@@ -111,7 +111,6 @@
        u8                      terminate;
        struct i2c_adapter      adapter;
 #ifdef CONFIG_CPU_FREQ
-       struct completion       xfr_complete;
        struct notifier_block   freq_transition;
 #endif
 };
@@ -452,10 +451,6 @@
                        return ret;
        }

-#ifdef CONFIG_CPU_FREQ
-       complete(&dev->xfr_complete);
-#endif
-
        return num;
 }

@@ -596,11 +591,12 @@

        dev = container_of(nb, struct davinci_i2c_dev, freq_transition);
        if (val == CPUFREQ_PRECHANGE) {
-               wait_for_completion(&dev->xfr_complete);
+               i2c_lock_adapter(&dev->adapter);
                davinci_i2c_reset_ctrl(dev, 0);
        } else if (val == CPUFREQ_POSTCHANGE) {
                i2c_davinci_calc_clk_dividers(dev);
                davinci_i2c_reset_ctrl(dev, 1);
+               i2c_unlock_adapter(&dev->adapter);
        }

        return 0;
@@ -669,9 +665,7 @@
        }

        init_completion(&dev->cmd_complete);
-#ifdef CONFIG_CPU_FREQ
-       init_completion(&dev->xfr_complete);
-#endif
+
        dev->dev = get_device(&pdev->dev);
        dev->irq = irq->start;
        platform_set_drvdata(pdev, dev);

Is this changeset what you expect to see? Looking at i2c-davinci.c, I think

        if (pdata->set_voltage && freqs.new < freqs.old)
                pdata->set_voltage(idx);

will block when switching to the lower frequency because of the i2c bus lock created by
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);

a few lines above?

RE: I2C 0x8 Address - Added by Jonathan Cormier over 9 years ago

And thats why i moved the cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); to below that line as seen in your diff above.

-       cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
-
        /* if moving to higher frequency, up the voltage beforehand */
        if (pdata->set_voltage && freqs.new > freqs.old) {
                ret = pdata->set_voltage(idx);
@@ -111,6 +109,8 @@
                        goto out;
        }

+       cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
+

RE: I2C 0x8 Address - Added by Mostafa Afgani over 9 years ago

Yes, that only works when moving to a higher frequency because the voltage adjustments are made before the call to cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);

When moving back down to the lower frequency, cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); is being called before the voltage adjustments are made, requiring the use of the I2C bus.

RE: I2C 0x8 Address - Added by Jonathan Cormier over 9 years ago

I see now. Odd that i'm not encountering this lockup.

I moved the other cpufreq_notify and pushed it to the branch. Let me know if that works now.

RE: I2C 0x8 Address - Added by Mostafa Afgani over 9 years ago

Yes, works fine now. Thanks Jonathan.

(26-37/37) Go to top
Add picture from clipboard (Maximum size: 1 GB)