2011-06-17 22:30:58 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2012-12-29 00:32:59 +00:00
|
|
|
* Copyright (C) 2011 by Amaury Pouly
|
2011-06-17 22:30:58 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-01-05 19:32:09 +00:00
|
|
|
|
2011-06-17 22:30:58 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
2014-01-05 19:32:09 +00:00
|
|
|
#include "kernel.h"
|
2011-06-17 22:30:58 +00:00
|
|
|
#include "dma-imx233.h"
|
2011-10-18 22:03:25 +00:00
|
|
|
#include "lcd.h"
|
|
|
|
#include "string.h"
|
2011-06-17 22:30:58 +00:00
|
|
|
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
#include "regs/apbh.h"
|
|
|
|
#include "regs/apbx.h"
|
|
|
|
|
2012-08-18 13:22:51 +00:00
|
|
|
// statistics about unaligned transfers
|
|
|
|
static int apb_nr_unaligned[32];
|
|
|
|
|
2011-06-17 22:30:58 +00:00
|
|
|
void imx233_dma_init(void)
|
|
|
|
{
|
|
|
|
/* Enable APHB and APBX */
|
2011-09-13 23:38:56 +00:00
|
|
|
imx233_reset_block(&HW_APBH_CTRL0);
|
|
|
|
imx233_reset_block(&HW_APBX_CTRL0);
|
2011-06-17 22:30:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void imx233_dma_reset_channel(unsigned chan)
|
|
|
|
{
|
2013-06-16 16:19:59 +00:00
|
|
|
uint32_t bm = 1 << APB_GET_DMA_CHANNEL(chan);
|
2011-06-17 22:30:58 +00:00
|
|
|
if(APB_IS_APBX_CHANNEL(chan))
|
2011-10-18 22:03:25 +00:00
|
|
|
{
|
2013-06-16 22:16:19 +00:00
|
|
|
#if IMX233_SUBTARGET < 3780
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBX_CTRL0_SET, RESET_CHANNEL(bm));
|
2013-06-16 22:16:19 +00:00
|
|
|
while(BF_RD(APBX_CTRL0, RESET_CHANNEL) & bm);
|
|
|
|
#else
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBX_CHANNEL_CTRL_SET, RESET_CHANNEL(bm));
|
2013-06-16 16:19:59 +00:00
|
|
|
while(BF_RD(APBX_CHANNEL_CTRL, RESET_CHANNEL) & bm);
|
2013-06-16 22:16:19 +00:00
|
|
|
#endif
|
2011-10-18 22:03:25 +00:00
|
|
|
}
|
2011-06-17 22:30:58 +00:00
|
|
|
else
|
2011-10-18 22:03:25 +00:00
|
|
|
{
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBH_CTRL0_SET, RESET_CHANNEL(bm));
|
2013-06-16 16:19:59 +00:00
|
|
|
while(BF_RD(APBH_CTRL0, RESET_CHANNEL) & bm);
|
2011-10-18 22:03:25 +00:00
|
|
|
}
|
2011-06-17 22:30:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void imx233_dma_clkgate_channel(unsigned chan, bool enable_clock)
|
|
|
|
{
|
|
|
|
if(APB_IS_APBX_CHANNEL(chan))
|
|
|
|
return;
|
|
|
|
if(enable_clock)
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBH_CTRL0_CLR, CLKGATE_CHANNEL(1 << APB_GET_DMA_CHANNEL(chan)));
|
2011-06-17 22:30:58 +00:00
|
|
|
else
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBH_CTRL0_SET, CLKGATE_CHANNEL(1 << APB_GET_DMA_CHANNEL(chan)));
|
2011-06-17 22:30:58 +00:00
|
|
|
}
|
|
|
|
|
2011-10-18 22:03:25 +00:00
|
|
|
void imx233_dma_freeze_channel(unsigned chan, bool freeze)
|
|
|
|
{
|
2013-06-16 16:19:59 +00:00
|
|
|
uint32_t bm = 1 << APB_GET_DMA_CHANNEL(chan);
|
2011-10-18 22:03:25 +00:00
|
|
|
if(APB_IS_APBX_CHANNEL(chan))
|
|
|
|
{
|
2013-06-16 22:16:19 +00:00
|
|
|
#if IMX233_SUBTARGET < 3780
|
|
|
|
if(freeze)
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBX_CTRL0_SET, FREEZE_CHANNEL(bm));
|
2013-06-16 22:16:19 +00:00
|
|
|
else
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBX_CTRL0_CLR, FREEZE_CHANNEL(bm));
|
2013-06-16 22:16:19 +00:00
|
|
|
#else
|
2013-06-16 16:19:59 +00:00
|
|
|
if(freeze)
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBX_CHANNEL_CTRL_SET, FREEZE_CHANNEL(bm));
|
2013-06-16 16:19:59 +00:00
|
|
|
else
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBX_CHANNEL_CTRL_CLR, FREEZE_CHANNEL(bm));
|
2013-06-16 22:16:19 +00:00
|
|
|
#endif
|
2011-10-18 22:03:25 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-06-16 16:19:59 +00:00
|
|
|
if(freeze)
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBH_CTRL0_SET, FREEZE_CHANNEL(bm));
|
2013-06-16 16:19:59 +00:00
|
|
|
else
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBH_CTRL0_CLR, FREEZE_CHANNEL(bm));
|
2011-10-18 22:03:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-17 22:30:58 +00:00
|
|
|
void imx233_dma_enable_channel_interrupt(unsigned chan, bool enable)
|
|
|
|
{
|
2013-06-16 16:19:59 +00:00
|
|
|
uint32_t bm = 1 << APB_GET_DMA_CHANNEL(chan);
|
2011-06-17 22:30:58 +00:00
|
|
|
if(APB_IS_APBX_CHANNEL(chan))
|
|
|
|
{
|
2013-06-16 16:19:59 +00:00
|
|
|
if(enable)
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBX_CTRL1_SET, CH_CMDCMPLT_IRQ_EN(bm));
|
2013-06-16 16:19:59 +00:00
|
|
|
else
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBX_CTRL1_CLR, CH_CMDCMPLT_IRQ_EN(bm));
|
2011-06-17 22:30:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-06-16 16:19:59 +00:00
|
|
|
if(enable)
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBH_CTRL1_SET, CH_CMDCMPLT_IRQ_EN(bm));
|
2013-06-16 16:19:59 +00:00
|
|
|
else
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBH_CTRL1_CLR, CH_CMDCMPLT_IRQ_EN(bm));
|
2011-06-17 22:30:58 +00:00
|
|
|
}
|
2013-06-16 16:19:59 +00:00
|
|
|
imx233_dma_clear_channel_interrupt(chan);
|
2011-06-17 22:30:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void imx233_dma_clear_channel_interrupt(unsigned chan)
|
|
|
|
{
|
2013-06-16 16:19:59 +00:00
|
|
|
uint32_t bm = 1 << APB_GET_DMA_CHANNEL(chan);
|
2011-06-17 22:30:58 +00:00
|
|
|
if(APB_IS_APBX_CHANNEL(chan))
|
|
|
|
{
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBX_CTRL1_CLR, CH_CMDCMPLT_IRQ(bm));
|
2013-06-16 22:16:19 +00:00
|
|
|
#if IMX233_SUBTARGET >= 3780
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBX_CTRL2_CLR, CH_ERROR_IRQ(bm));
|
2013-06-16 22:16:19 +00:00
|
|
|
#elif IMX233_SUBTARGET >= 3700
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBX_CTRL1_CLR, CH_AHB_ERROR_IRQ(bm));
|
2013-06-16 22:16:19 +00:00
|
|
|
#endif
|
2011-06-17 22:30:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBH_CTRL1_CLR, CH_CMDCMPLT_IRQ(bm));
|
2013-06-16 22:16:19 +00:00
|
|
|
#if IMX233_SUBTARGET >= 3780
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBH_CTRL2_CLR, CH_ERROR_IRQ(bm));
|
2013-06-16 22:16:19 +00:00
|
|
|
#elif IMX233_SUBTARGET >= 3700
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WR(APBH_CTRL1_CLR, CH_AHB_ERROR_IRQ(bm));
|
2013-06-16 22:16:19 +00:00
|
|
|
#endif
|
2011-06-17 22:30:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool imx233_dma_is_channel_error_irq(unsigned chan)
|
|
|
|
{
|
2013-06-16 16:19:59 +00:00
|
|
|
uint32_t bm = 1 << APB_GET_DMA_CHANNEL(chan);
|
2013-06-16 22:16:19 +00:00
|
|
|
#if IMX233_SUBTARGET >= 3780
|
2011-06-17 22:30:58 +00:00
|
|
|
if(APB_IS_APBX_CHANNEL(chan))
|
2013-06-16 16:19:59 +00:00
|
|
|
return !!(BF_RD(APBX_CTRL2, CH_ERROR_IRQ) & bm);
|
2011-06-17 22:30:58 +00:00
|
|
|
else
|
2013-06-16 16:19:59 +00:00
|
|
|
return !!(BF_RD(APBH_CTRL2, CH_ERROR_IRQ) & bm);
|
2013-06-16 22:16:19 +00:00
|
|
|
#elif IMX233_SUBTARGET >= 3700
|
|
|
|
if(APB_IS_APBX_CHANNEL(chan))
|
|
|
|
return !!(BF_RD(APBX_CTRL1, CH_AHB_ERROR_IRQ) & bm);
|
|
|
|
else
|
|
|
|
return !!(BF_RD(APBH_CTRL1, CH_AHB_ERROR_IRQ) & bm);
|
|
|
|
#else
|
|
|
|
(void) bm;
|
|
|
|
return false;
|
|
|
|
#endif
|
2011-06-17 22:30:58 +00:00
|
|
|
}
|
|
|
|
|
2011-07-23 11:45:22 +00:00
|
|
|
/* Commit and/or discard all DMA descriptors and buffers pointed by them,
|
2011-09-05 11:29:32 +00:00
|
|
|
* handle circular lists. At the same time, convert virtual pointers to
|
|
|
|
* real ones */
|
2013-06-16 22:16:19 +00:00
|
|
|
void imx233_dma_prepare_command(unsigned chan, struct apb_dma_command_t *cmd)
|
2011-07-23 11:45:22 +00:00
|
|
|
{
|
|
|
|
/* We handle circular descriptors by using unused bits:
|
|
|
|
* bits 8-11 are not used by the hardware so we first go through the whole
|
|
|
|
* list and mark them all a special value at the same time we commit buffers
|
|
|
|
* and then we go through the list another time to clear the mark and
|
|
|
|
* commit the descriptors */
|
|
|
|
struct apb_dma_command_t *cur = cmd;
|
2013-06-16 16:19:59 +00:00
|
|
|
|
|
|
|
while(BF_RDX(cur->cmd, APB_CHx_CMD, UNUSED) != BV_APB_CHx_CMD_UNUSED__MAGIC)
|
2011-07-23 11:45:22 +00:00
|
|
|
{
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WRX(cur->cmd, APB_CHx_CMD, UNUSED_V(MAGIC));
|
2013-06-16 16:19:59 +00:00
|
|
|
int op = BF_RDX(cur->cmd, APB_CHx_CMD, COMMAND);
|
|
|
|
int sz = BF_RDX(cur->cmd, APB_CHx_CMD, XFER_COUNT);
|
2011-07-23 11:45:22 +00:00
|
|
|
/* device > host: discard */
|
2013-06-16 16:19:59 +00:00
|
|
|
if(op == BV_APB_CHx_CMD_COMMAND__WRITE)
|
2011-07-23 11:45:22 +00:00
|
|
|
discard_dcache_range(cur->buffer, sz);
|
|
|
|
/* host > device: commit and discard */
|
2013-06-16 16:19:59 +00:00
|
|
|
else if(op == BV_APB_CHx_CMD_COMMAND__READ)
|
2011-07-23 11:45:22 +00:00
|
|
|
commit_discard_dcache_range(cur->buffer, sz);
|
2012-08-18 13:22:51 +00:00
|
|
|
if((uint32_t)cur->buffer % CACHEALIGN_SIZE)
|
|
|
|
apb_nr_unaligned[chan]++;
|
2011-09-05 11:29:32 +00:00
|
|
|
/* Virtual to physical buffer pointer conversion */
|
|
|
|
cur->buffer = PHYSICAL_ADDR(cur->buffer);
|
2011-07-23 11:45:22 +00:00
|
|
|
/* chain ? */
|
2013-06-16 16:19:59 +00:00
|
|
|
if(cur->cmd & BM_APB_CHx_CMD_CHAIN)
|
2011-07-23 11:45:22 +00:00
|
|
|
cur = cur->next;
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
cur = cmd;
|
2013-06-16 16:19:59 +00:00
|
|
|
while(BF_RDX(cur->cmd, APB_CHx, CMD_UNUSED) != 0)
|
2011-07-23 11:45:22 +00:00
|
|
|
{
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
BF_WRX(cur->cmd, APB_CHx, CMD_UNUSED(0));
|
2013-06-16 16:19:59 +00:00
|
|
|
int sz = BF_RDX(cur->cmd, APB_CHx_CMD, CMDWORDS) * sizeof(uint32_t);
|
2011-09-05 11:29:32 +00:00
|
|
|
/* commit descriptor and discard descriptor */
|
2011-07-23 11:45:22 +00:00
|
|
|
/* chain ? */
|
2013-06-16 16:19:59 +00:00
|
|
|
if(cur->cmd & BM_APB_CHx_CMD_CHAIN)
|
2011-09-05 11:29:32 +00:00
|
|
|
{
|
|
|
|
struct apb_dma_command_t *next = cur->next;
|
|
|
|
cur->next = PHYSICAL_ADDR(cur->next);
|
|
|
|
commit_dcache_range(cur, sizeof(struct apb_dma_command_t) + sz);
|
|
|
|
cur = next;
|
|
|
|
}
|
2011-07-23 11:45:22 +00:00
|
|
|
else
|
2011-09-05 11:29:32 +00:00
|
|
|
{
|
|
|
|
commit_dcache_range(cur, sizeof(struct apb_dma_command_t) + sz);
|
2011-07-23 11:45:22 +00:00
|
|
|
break;
|
2011-09-05 11:29:32 +00:00
|
|
|
}
|
2011-07-23 11:45:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-16 22:16:19 +00:00
|
|
|
void imx233_dma_set_next_command(unsigned chan, struct apb_dma_command_t *cmd)
|
2011-06-17 22:30:58 +00:00
|
|
|
{
|
|
|
|
if(APB_IS_APBX_CHANNEL(chan))
|
2013-06-16 16:19:59 +00:00
|
|
|
HW_APBX_CHn_NXTCMDAR(APB_GET_DMA_CHANNEL(chan)) = (uint32_t)PHYSICAL_ADDR(cmd);
|
2011-06-17 22:30:58 +00:00
|
|
|
else
|
2013-06-16 16:19:59 +00:00
|
|
|
HW_APBH_CHn_NXTCMDAR(APB_GET_DMA_CHANNEL(chan)) = (uint32_t)PHYSICAL_ADDR(cmd);
|
2013-06-16 22:16:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void imx233_dma_inc_sema(unsigned chan, unsigned amount)
|
|
|
|
{
|
|
|
|
if(APB_IS_APBX_CHANNEL(chan))
|
|
|
|
HW_APBX_CHn_SEMA(APB_GET_DMA_CHANNEL(chan)) = amount;
|
|
|
|
else
|
|
|
|
HW_APBH_CHn_SEMA(APB_GET_DMA_CHANNEL(chan)) = amount;
|
|
|
|
}
|
|
|
|
|
|
|
|
void imx233_dma_start_command(unsigned chan, struct apb_dma_command_t *cmd)
|
|
|
|
{
|
|
|
|
imx233_dma_prepare_command(chan, cmd);
|
|
|
|
imx233_dma_set_next_command(chan, cmd);
|
|
|
|
imx233_dma_inc_sema(chan, 1);
|
2011-06-17 22:30:58 +00:00
|
|
|
}
|
|
|
|
|
2012-08-18 13:22:51 +00:00
|
|
|
int imx233_dma_wait_completion(unsigned chan, unsigned tmo)
|
2011-06-17 22:30:58 +00:00
|
|
|
{
|
2012-08-18 13:22:51 +00:00
|
|
|
tmo += current_tick;
|
2013-06-16 16:19:59 +00:00
|
|
|
int value = 0;
|
2011-06-17 22:30:58 +00:00
|
|
|
if(APB_IS_APBX_CHANNEL(chan))
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
while((value = BF_RD(APBX_CHn_SEMA(APB_GET_DMA_CHANNEL(chan)), PHORE)) && !TIME_AFTER(current_tick, tmo))
|
2013-06-16 16:19:59 +00:00
|
|
|
yield();
|
2011-06-17 22:30:58 +00:00
|
|
|
else
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
while((value = BF_RD(APBH_CHn_SEMA(APB_GET_DMA_CHANNEL(chan)), PHORE)) && !TIME_AFTER(current_tick, tmo))
|
2013-06-16 16:19:59 +00:00
|
|
|
yield();
|
2011-06-17 22:30:58 +00:00
|
|
|
|
2013-06-16 16:19:59 +00:00
|
|
|
return value;
|
2011-06-17 22:30:58 +00:00
|
|
|
}
|
2011-10-18 22:03:25 +00:00
|
|
|
|
|
|
|
struct imx233_dma_info_t imx233_dma_get_info(unsigned chan, unsigned flags)
|
|
|
|
{
|
|
|
|
struct imx233_dma_info_t s;
|
|
|
|
memset(&s, 0, sizeof(s));
|
|
|
|
bool apbx = APB_IS_APBX_CHANNEL(chan);
|
|
|
|
int dmac = APB_GET_DMA_CHANNEL(chan);
|
2013-06-16 16:19:59 +00:00
|
|
|
uint32_t bm = 1 << dmac;
|
2011-10-18 22:03:25 +00:00
|
|
|
if(flags & DMA_INFO_CURCMDADDR)
|
2013-06-16 16:19:59 +00:00
|
|
|
s.cur_cmd_addr = apbx ? HW_APBX_CHn_CURCMDAR(dmac) : HW_APBH_CHn_CURCMDAR(dmac);
|
2011-10-18 22:03:25 +00:00
|
|
|
if(flags & DMA_INFO_NXTCMDADDR)
|
2013-06-16 16:19:59 +00:00
|
|
|
s.nxt_cmd_addr = apbx ? HW_APBX_CHn_NXTCMDAR(dmac) : HW_APBH_CHn_NXTCMDAR(dmac);
|
2011-10-18 22:03:25 +00:00
|
|
|
if(flags & DMA_INFO_CMD)
|
2013-06-16 16:19:59 +00:00
|
|
|
s.cmd = apbx ? HW_APBX_CHn_CMD(dmac) : HW_APBH_CHn_CMD(dmac);
|
2011-10-18 22:03:25 +00:00
|
|
|
if(flags & DMA_INFO_BAR)
|
2013-06-16 16:19:59 +00:00
|
|
|
s.bar = apbx ? HW_APBX_CHn_BAR(dmac) : HW_APBH_CHn_BAR(dmac);
|
2011-10-18 22:03:25 +00:00
|
|
|
if(flags & DMA_INFO_AHB_BYTES)
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
s.ahb_bytes = apbx ? BF_RD(APBX_CHn_DEBUG2(dmac), AHB_BYTES) : BF_RD(APBH_CHn_DEBUG2(dmac), AHB_BYTES);
|
2011-10-18 22:03:25 +00:00
|
|
|
if(flags & DMA_INFO_APB_BYTES)
|
imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.
The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
its equivalent for BF_WR(reg_SET, ...)
I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".
Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml
Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-24 19:29:56 +00:00
|
|
|
s.apb_bytes = apbx ? BF_RD(APBX_CHn_DEBUG2(dmac), APB_BYTES) : BF_RD(APBH_CHn_DEBUG2(dmac), APB_BYTES);
|
2014-02-03 23:27:06 +00:00
|
|
|
if(flags & DMA_INFO_FROZEN)
|
2013-06-16 22:16:19 +00:00
|
|
|
#if IMX233_SUBTARGET < 3780
|
2014-02-03 23:27:06 +00:00
|
|
|
s.frozen = !!((apbx ? BF_RD(APBX_CTRL0, FREEZE_CHANNEL) : BF_RD(APBH_CTRL0, FREEZE_CHANNEL)) & bm);
|
2013-06-16 22:16:19 +00:00
|
|
|
#else
|
2014-02-03 23:27:06 +00:00
|
|
|
s.frozen = !!((apbx ? BF_RD(APBX_CHANNEL_CTRL, FREEZE_CHANNEL) : BF_RD(APBH_CTRL0, FREEZE_CHANNEL)) & bm);
|
2013-06-16 22:16:19 +00:00
|
|
|
#endif
|
2011-10-18 22:03:25 +00:00
|
|
|
if(flags & DMA_INFO_GATED)
|
2013-06-16 16:19:59 +00:00
|
|
|
s.gated = apbx ? false : !!(BF_RD(APBH_CTRL0, CLKGATE_CHANNEL) & bm);
|
2011-10-18 22:03:25 +00:00
|
|
|
if(flags & DMA_INFO_INTERRUPT)
|
|
|
|
{
|
2013-06-16 16:19:59 +00:00
|
|
|
s.int_enabled = !!((apbx ? BF_RD(APBX_CTRL1, CH_CMDCMPLT_IRQ_EN) : BF_RD(APBH_CTRL1, CH_CMDCMPLT_IRQ_EN)) & bm);
|
|
|
|
s.int_cmdcomplt = !!((apbx ? BF_RD(APBX_CTRL1, CH_CMDCMPLT_IRQ) : BF_RD(APBH_CTRL1, CH_CMDCMPLT_IRQ)) & bm);
|
2013-06-16 22:16:19 +00:00
|
|
|
#if IMX233_SUBTARGET >= 3780
|
2013-06-16 16:19:59 +00:00
|
|
|
s.int_error = !!((apbx ? BF_RD(APBX_CTRL2, CH_ERROR_IRQ) : BF_RD(APBH_CTRL2, CH_ERROR_IRQ)) & bm);
|
2013-06-16 22:16:19 +00:00
|
|
|
#elif IMX233_SUBTARGET >= 3700
|
|
|
|
s.int_error = !!((apbx ? BF_RD(APBX_CTRL1, CH_AHB_ERROR_IRQ) : BF_RD(APBH_CTRL1, CH_AHB_ERROR_IRQ)) & bm);
|
|
|
|
#else
|
|
|
|
s.int_error = false;
|
|
|
|
#endif
|
2011-10-18 22:03:25 +00:00
|
|
|
}
|
2012-08-18 13:22:51 +00:00
|
|
|
s.nr_unaligned = apb_nr_unaligned[chan];
|
2011-10-18 22:03:25 +00:00
|
|
|
return s;
|
|
|
|
}
|