We are trying to toggle GPIO15 with our custom DM365 EVM with OV5642
sensor. GPIO15 is sensor reset pin for OV5642.
It is observed that pin is not getting toggled. We tried in u-boot as well as kernel level. Please find
the sequence followed to toggle GPIO15
Generic Sequence:
---------------------
1. Pin muxing
2. Set the gpio direction
3. toggle GPIO
u-boot 1.3.4:
-------------
At u-boot, we tried the following sequence to toggle GPIO15
1. Mux setting
a. Read the value
md 0x01C4000c 0x1
b. Write the value
mw 0x01C4000c <above readvalue & 0xffffbfff>
2. Setting direction as output
md 0x01C67010 0x1
mw 0x01C67010 <readval & 0xffff7fff>
3. Drive High
md 0x01C67018 0x1
mw 0x01C67018 <readval | 0x00008000>
4. Drive Low
md 0x01C6701C 0x1
mw 0x01C6701C <readval | 0x00008000>
----------------------- u-boot log - starts -------------------
DM365 EVM :>
DM365 EVM :>
DM365 EVM :>md 0x01c4000c 1
01c4000c: 015affff ..Z.
DM365 EVM :>mw 0x01c4000c 015abfff
DM365 EVM :>md 0x01c4000c 1
01c4000c: 015abfff ..Z.
DM365 EVM :>
DM365 EVM :>
DM365 EVM :>md 0x01c67010 1
01c67010: 00000000 ....
DM365 EVM :>
DM365 EVM :>
DM365 EVM :>md 0x01c67018 1
01c67018: 00100000 ....
DM365 EVM :>mw 0x01c67018 00108000
DM365 EVM :>md 0x01c67018 1
01c67018: 00108000 ....
DM365 EVM :>
DM365 EVM :>
DM365 EVM :>
DM365 EVM :>md 0x01c6701c 1
01c6701c: 00108000 ....
DM365 EVM :>mw 0x01c6701c 00008000
DM365 EVM :>md 0x01c6701c 1
01c6701c: 00100000 ....
DM365 EVM :>md 0x01c67018 1
01c67018: 00108000 ....
DM365 EVM :>
DM365 EVM :>md 0x01c67014 1
01c67014: 00108000 ....
DM365 EVM :>
DM365 EVM :>mw 0x01c67014 00100000
DM365 EVM :>md 0x01c67014 1
01c67014: 00100000 ....
DM365 EVM :>
DM365 EVM :>
DM365 EVM :>mw 0x01c67014 001008000
DM365 EVM :>md 0x01c67014 1
01c67014: 01008000
DM365 EVM :>
----------------------- u-boot-log - ends ---------------------
Kernel 2.6.32.17-davinci1:
-------------------------
The following code is written to toggle the GPIO15
/* mux settings for GIO15 */
/* GPIO 15 */
value = __raw_readl(muxbase + 0x0000000c);
value = value & 0xffffbfff;
__raw_writel(value, muxbase);
/* gpio direction set for 15 */
value = __raw_readl(gpiobase + 0x00000010);
value = value & 0xffff7fff;
__raw_writel(value, gpiobase + 0x00000010);
/* GPIO15 : Drive Low */
value = __raw_readl(gpiobase + 0x0000001c);
value = value & 0x00008000;
__raw_writel(value, gpiobase + 0x0000001c);
mdelay(500);
/* GPIO15 : Drive High */
value = __raw_readl(gpiobase + 0x00000018);
value = value & 0x00008000;
__raw_writel(value, gpiobase + 0x00000018);
Even though, we are making high, GPIO15 always in Low state. Please let
us know that the above sequences are correct? Are we missing anything
before pinmuxing?