2020-05-10 17:52:40 +02:00
|
|
|
/* Source : APQ8064 LK boot */
|
treewide: Replace BSD-3-Clause and ISC headers with SPDX headers
Commands used:
perl -i -p0e 's|\/\*[*\s]*Permission[*\s]*to[*\s]*use,[*\s]*copy,[*\s]*modify,[*\s]*and.or[*\s]*distribute[*\s]*this[*\s]*software[*\s]*for[*\s]*any[*\s]*purpose[*\s]*with[*\s]*or[*\s]*without[*\s]*fee[*\s]*is[*\s]*hereby[*\s]*granted,[*\s]*provided[*\s]*that[*\s]*the[*\s]*above[*\s]*copyright[*\s]*notice[*\s]*and[*\s]*this[*\s]*permission[*\s]*notice[*\s]*appear[*\s]*in[*\s]*all[*\s]*copies.[*\s]*THE[*\s]*SOFTWARE[*\s]*IS[*\s]*PROVIDED[*\s]*.*AS[*\s]*IS.*[*\s]*AND[*\s]*THE[*\s]*AUTHOR[*\s]*DISCLAIMS[*\s]*ALL[*\s]*WARRANTIES[*\s]*WITH[*\s]*REGARD[*\s]*TO[*\s]*THIS[*\s]*SOFTWARE[*\s]*INCLUDING[*\s]*ALL[*\s]*IMPLIED[*\s]*WARRANTIES[*\s]*OF[*\s]*MERCHANTABILITY[*\s]*AND[*\s]*FITNESS.[*\s]*IN[*\s]*NO[*\s]*EVENT[*\s]*SHALL[*\s]*THE[*\s]*AUTHOR[*\s]*BE[*\s]*LIABLE[*\s]*FOR[*\s]*ANY[*\s]*SPECIAL,[*\s]*DIRECT,[*\s]*INDIRECT,[*\s]*OR[*\s]*CONSEQUENTIAL[*\s]*DAMAGES[*\s]*OR[*\s]*ANY[*\s]*DAMAGES[*\s]*WHATSOEVER[*\s]*RESULTING[*\s]*FROM[*\s]*LOSS[*\s]*OF[*\s]*USE,[*\s]*DATA[*\s]*OR[*\s]*PROFITS,[*\s]*WHETHER[*\s]*IN[*\s]*AN[*\s]*ACTION[*\s]*OF[*\s]*CONTRACT,[*\s]*NEGLIGENCE[*\s]*OR[*\s]*OTHER[*\s]*TORTIOUS[*\s]*ACTION,[*\s]*ARISING[*\s]*OUT[*\s]*OF[*\s]*OR[*\s]*IN[*\s]*CONNECTION[*\s]*WITH[*\s]*THE[*\s]*USE[*\s]*OR[*\s]*PERFORMANCE[*\s]*OF[*\s]*THIS[*\s]*SOFTWARE.[*\s]*\*\/|/* SPDX-License-Identifier: ISC */|s' $(cat filelist)
perl -i -p0e 's|(\#\#*)\s*Permission[\#\s]*to[\#\s]*use,[\#\s]*copy,[\#\s]*modify,[\#\s]*and.or[\#\s]*distribute[\#\s]*this[\#\s]*software[\#\s]*for[\#\s]*any[\#\s]*purpose[\#\s]*with[\#\s]*or[\#\s]*without[\#\s]*fee[\#\s]*is[\#\s]*hereby[\#\s]*granted,[\#\s]*provided[\#\s]*that[\#\s]*the[\#\s]*above[\#\s]*copyright[\#\s]*notice[\#\s]*and[\#\s]*this[\#\s]*permission[\#\s]*notice[\#\s]*appear[\#\s]*in[\#\s]*all[\#\s]*copies.[\#\s]*THE[\#\s]*SOFTWARE[\#\s]*IS[\#\s]*PROVIDED[\#\s]*.*AS[\#\s]*IS.*[\#\s]*AND[\#\s]*THE[\#\s]*AUTHOR[\#\s]*DISCLAIMS[\#\s]*ALL[\#\s]*WARRANTIES[\#\s]*WITH[\#\s]*REGARD[\#\s]*TO[\#\s]*THIS[\#\s]*SOFTWARE[\#\s]*INCLUDING[\#\s]*ALL[\#\s]*IMPLIED[\#\s]*WARRANTIES[\#\s]*OF[\#\s]*MERCHANTABILITY[\#\s]*AND[\#\s]*FITNESS.[\#\s]*IN[\#\s]*NO[\#\s]*EVENT[\#\s]*SHALL[\#\s]*THE[\#\s]*AUTHOR[\#\s]*BE[\#\s]*LIABLE[\#\s]*FOR[\#\s]*ANY[\#\s]*SPECIAL,[\#\s]*DIRECT,[\#\s]*INDIRECT,[\#\s]*OR[\#\s]*CONSEQUENTIAL[\#\s]*DAMAGES[\#\s]*OR[\#\s]*ANY[\#\s]*DAMAGES[\#\s]*WHATSOEVER[\#\s]*RESULTING[\#\s]*FROM[\#\s]*LOSS[\#\s]*OF[\#\s]*USE,[\#\s]*DATA[\#\s]*OR[\#\s]*PROFITS,[\#\s]*WHETHER[\#\s]*IN[\#\s]*AN[\#\s]*ACTION[\#\s]*OF[\#\s]*CONTRACT,[\#\s]*NEGLIGENCE[\#\s]*OR[\#\s]*OTHER[\#\s]*TORTIOUS[\#\s]*ACTION,[\#\s]*ARISING[\#\s]*OUT[\#\s]*OF[\#\s]*OR[\#\s]*IN[\#\s]*CONNECTION[\#\s]*WITH[\#\s]*THE[\#\s]*USE[\#\s]*OR[\#\s]*PERFORMANCE[\#\s]*OF[\#\s]*THIS[\#\s]*SOFTWARE.\s(\#* *\n)*|\1 SPDX-License-Identifier: ISC\n\n|s' $(cat filelist)
perl -i -p0e 's|\/\*[*\s]*Redistribution[*\s]*and[*\s]*use[*\s]*in[*\s]*source[*\s]*and[*\s]*binary[*\s]*forms,[*\s]*with[*\s]*or[*\s]*without[*\s]*modification,[*\s]*are[*\s]*permitted[*\s]*provided[*\s]*that[*\s]*the[*\s]*following[*\s]*conditions[*\s]*are[*\s]*met:[*\s]*[1. ]*Redistributions[*\s]*of[*\s]*source[*\s]*code[*\s]*must[*\s]*retain[*\s]*the[*\s]*above[*\s]*copyright[*\s]*notice,[*\s]*this[*\s]*list[*\s]*of[*\s]*conditions[*\s]*and[*\s]*the[*\s]*following[*\s]*disclaimer.[*\s]*[*\s]*[2. ]*Redistributions[*\s]*in[*\s]*binary[*\s]*form[*\s]*must[*\s]*reproduce[*\s]*the[*\s]*above[*\s]*copyright[*\s]*notice,[*\s]*this[*\s]*list[*\s]*of[*\s]*conditions[*\s]*and[*\s]*the[*\s]*following[*\s]*disclaimer[*\s]*in[*\s]*the[*\s]*documentation[*\s]*and.or[*\s]*other[*\s]*materials[*\s]*provided[*\s]*with[*\s]*the[*\s]*distribution.[*\s]*[3. ]*.*used[*\s]*to[*\s]*endorse[*\s]*or[*\s]*promote[*\s]*products[*\s]*derived[*\s]*from[*\s]*this[*\s]*software[*\s]*without[*\s]*specific[*\s]*prior[*\s]*written[*\s]*permission.[*\s]*THIS[*\s]*SOFTWARE[*\s]*IS[*\s]*PROVIDED.*AS[*\s]*IS.*[*\s]*AND[*\s]*ANY[*\s]*EXPRESS[*\s]*OR[*\s]*IMPLIED[*\s]*WARRANTIES,[*\s]*INCLUDING,[*\s]*BUT[*\s]*NOT[*\s]*LIMITED[*\s]*TO,[*\s]*THE[*\s]*IMPLIED[*\s]*WARRANTIES[*\s]*OF[*\s]*MERCHANTABILITY.*FITNESS[*\s]*FOR[*\s]*A[*\s]*PARTICULAR[*\s]*PURPOSE.*ARE[*\s]*DISCLAIMED.[*\s]*IN[*\s]*NO[*\s]*EVENT[*\s]*SHALL.*LIABLE[*\s]*FOR[*\s]*ANY[*\s]*DIRECT,[*\s]*INDIRECT,[*\s]*INCIDENTAL,[*\s]*SPECIAL,[*\s]*EXEMPLARY,[*\s]*OR[*\s]*CONSEQUENTIAL[*\s]*DAMAGES[*\s]*.INCLUDING,[*\s]*BUT[*\s]*NOT[*\s]*LIMITED[*\s]*TO,[*\s]*PROCUREMENT[*\s]*OF[*\s]*SUBSTITUTE[*\s]*GOODS[*\s]*OR[*\s]*SERVICES;[*\s]*LOSS[*\s]*OF[*\s]*USE,[*\s]*DATA,[*\s]*OR[*\s]*PROFITS;[*\s]*OR[*\s]*BUSINESS[*\s]*INTERRUPTION.[*\s]*HOWEVER[*\s]*CAUSED[*\s]*AND[*\s]*ON[*\s]*ANY[*\s]*THEORY[*\s]*OF[*\s]*LIABILITY,[*\s]*WHETHER[*\s]*IN[*\s]*CONTRACT,[*\s]*STRICT[*\s]*LIABILITY,[*\s]*OR[*\s]*TORT[*\s]*.INCLUDING[*\s]*NEGLIGENCE[*\s]*OR[*\s]*OTHERWISE.[*\s]*ARISING[*\s]*IN[*\s]*ANY[*\s]*WAY[*\s]*OUT[*\s]*OF[*\s]*THE[*\s]*USE[*\s]*OF[*\s]*THIS[*\s]*SOFTWARE,[*\s]*EVEN[*\s]*IF[*\s]*ADVISED[*\s]*OF[*\s]*THE[*\s]*POSSIBILITY[*\s]*OF[*\s]*SUCH[*\s]*DAMAGE.[*\s]*\*\/|/* SPDX-License-Identifier: BSD-3-Clause */|s' $(cat filelist) $1
perl -i -p0e 's|(\#\#*) *Redistribution[\#\s]*and[\#\s]*use[\#\s]*in[\#\s]*source[\#\s]*and[\#\s]*binary[\#\s]*forms,[\#\s]*with[\#\s]*or[\#\s]*without[\#\s]*modification,[\#\s]*are[\#\s]*permitted[\#\s]*provided[\#\s]*that[\#\s]*the[\#\s]*following[\#\s]*conditions[\#\s]*are[\#\s]*met:[\#\s]*[*1. ]*Redistributions[\#\s]*of[\#\s]*source[\#\s]*code[\#\s]*must[\#\s]*retain[\#\s]*the[\#\s]*above[\#\s]*copyright[\#\s]*notice,[\#\s]*this[\#\s]*list[\#\s]*of[\#\s]*conditions[\#\s]*and[\#\s]*the[\#\s]*following[\#\s]*disclaimer.[\#\s]*[*2. ]*Redistributions[\#\s]*in[\#\s]*binary[\#\s]*form[\#\s]*must[\#\s]*reproduce[\#\s]*the[\#\s]*above[\#\s]*copyright[\#\s]*notice,[\#\s]*this[\#\s]*list[\#\s]*of[\#\s]*conditions[\#\s]*and[\#\s]*the[\#\s]*following[\#\s]*disclaimer[\#\s]*in[\#\s]*the[\#\s]*documentation[\#\s]*and.or[\#\s]*other[\#\s]*materials[\#\s]*provided[\#\s]*with[\#\s]*the[\#\s]*distribution.[\#\s]*[\#\s]*[*3. ]*.*used[\#\s]*to[\#\s]*endorse[\#\s]*or[\#\s]*promote[\#\s]*products[\#\s]*derived[\#\s]*from[\#\s]*this[\#\s]*software[\#\s]*without[\#\s]*specific[\#\s]*prior[\#\s]*written[\#\s]*permission.[\#\s]*THIS[\#\s]*SOFTWARE[\#\s]*IS[\#\s]*PROVIDED.*AS[\#\s]*IS.*[\#\s]*AND[\#\s]*ANY[\#\s]*EXPRESS[\#\s]*OR[\#\s]*IMPLIED[\#\s]*WARRANTIES,[\#\s]*INCLUDING,[\#\s]*BUT[\#\s]*NOT[\#\s]*LIMITED[\#\s]*TO,[\#\s]*THE[\#\s]*IMPLIED[\#\s]*WARRANTIES[\#\s]*OF[\#\s]*MERCHANTABILITY.*FITNESS[\#\s]*FOR[\#\s]*A[\#\s]*PARTICULAR[\#\s]*PURPOSE.*ARE[\#\s]*DISCLAIMED.[\#\s]*IN[\#\s]*NO[\#\s]*EVENT[\#\s]*SHALL.*LIABLE[\#\s]*FOR[\#\s]*ANY[\#\s]*DIRECT,[\#\s]*INDIRECT,[\#\s]*INCIDENTAL,[\#\s]*SPECIAL,[\#\s]*EXEMPLARY,[\#\s]*OR[\#\s]*CONSEQUENTIAL[\#\s]*DAMAGES[\#\s]*.INCLUDING,[\#\s]*BUT[\#\s]*NOT[\#\s]*LIMITED[\#\s]*TO,[\#\s]*PROCUREMENT[\#\s]*OF[\#\s]*SUBSTITUTE[\#\s]*GOODS[\#\s]*OR[\#\s]*SERVICES;[\#\s]*LOSS[\#\s]*OF[\#\s]*USE,[\#\s]*DATA,[\#\s]*OR[\#\s]*PROFITS;[\#\s]*OR[\#\s]*BUSINESS[\#\s]*INTERRUPTION.[\#\s]*HOWEVER[\#\s]*CAUSED[\#\s]*AND[\#\s]*ON[\#\s]*ANY[\#\s]*THEORY[\#\s]*OF[\#\s]*LIABILITY,[\#\s]*WHETHER[\#\s]*IN[\#\s]*CONTRACT,[\#\s]*STRICT[\#\s]*LIABILITY,[\#\s]*OR[\#\s]*TORT[\#\s]*.INCLUDING[\#\s]*NEGLIGENCE[\#\s]*OR[\#\s]*OTHERWISE.[\#\s]*ARISING[\#\s]*IN[\#\s]*ANY[\#\s]*WAY[\#\s]*OUT[\#\s]*OF[\#\s]*THE[\#\s]*USE[\#\s]*OF[\#\s]*THIS[\#\s]*SOFTWARE,[\#\s]*EVEN[\#\s]*IF[\#\s]*ADVISED[\#\s]*OF[\#\s]*THE[\#\s]*POSSIBILITY[\#\s]*OF[\#\s]*SUCH[\#\s]*DAMAGE.\s(\#* *\n)*|\1 SPDX-License-Identifier: BSD-3-Clause\n\n|s' $(cat filelist)
Change-Id: I7ff9c503a2efe1017a4666baf0b1a758a04f5634
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41204
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
2020-05-10 18:47:05 +02:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause */
|
2014-04-09 03:45:46 +02:00
|
|
|
|
2019-03-03 07:01:05 +01:00
|
|
|
#include <device/mmio.h>
|
2014-04-23 23:00:59 +02:00
|
|
|
#include <boot/coreboot_tables.h>
|
|
|
|
#include <console/uart.h>
|
2014-10-20 22:20:49 +02:00
|
|
|
#include <delay.h>
|
gpio: Extend common GPIO header, simplify function names
We've had gpiolib.h which defines a few common GPIO access functions for
a while, but it wasn't really complete. This patch adds the missing
gpio_output() function, and also renames the unwieldy
gpio_get_in_value() and gpio_set_out_value() to the much easier to
handle gpio_get() and gpio_set(). The header is renamed to the simpler
gpio.h while we're at it (there was never really anything "lib" about
it, and it was presumably just chosen due to the IPQ806x include/
conflict problem that is now resolved).
It also moves the definition of gpio_t into SoC-specific code, so that
different implementations are free to encode their platform-specific
GPIO parameters in those 4 bytes in the most convenient way (such as the
rk3288 with a bitfield struct). Every SoC intending to use this common
API should supply a <soc/gpio.h> that typedefs gpio_t to a type at most
4 bytes in length. Files accessing the API only need to include <gpio.h>
which may pull in additional things (like a gpio_t creation macro) from
<soc/gpio.h> on its own.
For now the API is still only used on non-x86 SoCs. Whether it makes
sense to expand it to x86 as well should be separately evaluated at a
later point (by someone who understands those systems better). Also,
Exynos retains its old, incompatible GPIO API even though it would be a
prime candidate, because it's currently just not worth the effort.
BUG=None
TEST=Compiled on Daisy, Peach_Pit, Nyan_Blaze, Rush_Ryu, Storm and
Veyron_Pinky.
Change-Id: Ieee77373c2bd13d07ece26fa7f8b08be324842fe
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 9e04902ada56b929e3829f2c3b4aeb618682096e
Original-Change-Id: I6c1e7d1e154d9b02288aabedb397e21e1aadfa15
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/220975
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/9400
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2014-09-25 00:40:49 +02:00
|
|
|
#include <gpio.h>
|
2014-10-20 22:20:49 +02:00
|
|
|
#include <soc/clock.h>
|
|
|
|
#include <soc/gsbi.h>
|
|
|
|
#include <soc/ipq_uart.h>
|
2014-04-23 23:00:59 +02:00
|
|
|
#include <stdint.h>
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
#define FIFO_DATA_SIZE 4
|
|
|
|
|
2014-04-23 23:00:59 +02:00
|
|
|
typedef struct {
|
2015-01-13 21:46:57 +01:00
|
|
|
void *uart_dm_base;
|
|
|
|
void *uart_gsbi_base;
|
2019-10-24 05:45:23 +02:00
|
|
|
unsigned int uart_gsbi;
|
2014-04-23 23:00:59 +02:00
|
|
|
uart_clk_mnd_t mnd_value;
|
|
|
|
gpio_func_data_t dbg_uart_gpio[NO_OF_DBG_UART_GPIOS];
|
|
|
|
} uart_params_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* All constants lifted from u-boot's
|
|
|
|
* board/qcom/ipq806x_cdp/ipq806x_board_param.h
|
|
|
|
*/
|
|
|
|
static const uart_params_t uart_board_param = {
|
2015-01-13 21:46:57 +01:00
|
|
|
.uart_dm_base = (void *)UART4_DM_BASE,
|
|
|
|
.uart_gsbi_base = (void *)UART_GSBI4_BASE,
|
2014-04-23 23:00:59 +02:00
|
|
|
.uart_gsbi = GSBI_4,
|
|
|
|
.mnd_value = { 12, 625, 313 },
|
2015-01-13 21:46:57 +01:00
|
|
|
.dbg_uart_gpio = {
|
|
|
|
{
|
|
|
|
.gpio = 10,
|
|
|
|
.func = 1,
|
|
|
|
.dir = GPIO_OUTPUT,
|
|
|
|
.pull = GPIO_NO_PULL,
|
|
|
|
.drvstr = GPIO_12MA,
|
|
|
|
.enable = GPIO_DISABLE
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = 11,
|
|
|
|
.func = 1,
|
|
|
|
.dir = GPIO_INPUT,
|
|
|
|
.pull = GPIO_NO_PULL,
|
|
|
|
.drvstr = GPIO_12MA,
|
|
|
|
.enable = GPIO_DISABLE
|
|
|
|
},
|
|
|
|
}
|
2014-04-23 23:00:59 +02:00
|
|
|
};
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* msm_boot_uart_dm_init_rx_transfer - Init Rx transfer
|
2016-07-06 18:17:19 +02:00
|
|
|
* @param uart_dm_base: UART controller base address
|
2014-04-09 03:45:46 +02:00
|
|
|
*/
|
2015-01-13 21:46:57 +01:00
|
|
|
static unsigned int msm_boot_uart_dm_init_rx_transfer(void *uart_dm_base)
|
2014-04-09 03:45:46 +02:00
|
|
|
{
|
|
|
|
/* Reset receiver */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_CR(uart_dm_base),
|
|
|
|
MSM_BOOT_UART_DM_CMD_RESET_RX);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* Enable receiver */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_CR(uart_dm_base),
|
|
|
|
MSM_BOOT_UART_DM_CR_RX_ENABLE);
|
|
|
|
write32(MSM_BOOT_UART_DM_DMRX(uart_dm_base),
|
|
|
|
MSM_BOOT_UART_DM_DMRX_DEF_VALUE);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* Clear stale event */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_CR(uart_dm_base),
|
|
|
|
MSM_BOOT_UART_DM_CMD_RES_STALE_INT);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* Enable stale event */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_CR(uart_dm_base),
|
|
|
|
MSM_BOOT_UART_DM_GCMD_ENA_STALE_EVT);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
return MSM_BOOT_UART_DM_E_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2015-01-13 22:07:48 +01:00
|
|
|
static unsigned int msm_boot_uart_dm_init(void *uart_dm_base);
|
|
|
|
|
|
|
|
/* Received data is valid or not */
|
|
|
|
static int valid_data = 0;
|
|
|
|
|
|
|
|
/* Received data */
|
|
|
|
static unsigned int word = 0;
|
|
|
|
|
2014-04-09 03:45:46 +02:00
|
|
|
/**
|
|
|
|
* msm_boot_uart_dm_read - reads a word from the RX FIFO.
|
|
|
|
* @data: location where the read data is stored
|
|
|
|
* @count: no of valid data in the FIFO
|
|
|
|
* @wait: indicates blocking call or not blocking call
|
|
|
|
*
|
|
|
|
* Reads a word from the RX FIFO. If no data is available blocks if
|
|
|
|
* @wait is true, else returns %MSM_BOOT_UART_DM_E_RX_NOT_READY.
|
|
|
|
*/
|
2014-04-23 23:00:59 +02:00
|
|
|
#if 0 /* Not used yet */
|
2014-04-09 03:45:46 +02:00
|
|
|
static unsigned int
|
|
|
|
msm_boot_uart_dm_read(unsigned int *data, int *count, int wait)
|
|
|
|
{
|
|
|
|
static int total_rx_data = 0;
|
|
|
|
static int rx_data_read = 0;
|
2015-01-13 21:46:57 +01:00
|
|
|
void *base;
|
2014-04-09 03:45:46 +02:00
|
|
|
uint32_t status_reg;
|
|
|
|
|
2014-04-23 23:00:59 +02:00
|
|
|
base = uart_board_param.uart_dm_base;
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
if (data == NULL)
|
|
|
|
return MSM_BOOT_UART_DM_E_INVAL;
|
|
|
|
|
2015-01-13 21:46:57 +01:00
|
|
|
status_reg = readl(MSM_BOOT_UART_DM_MISR(base));
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* Check for DM_RXSTALE for RX transfer to finish */
|
|
|
|
while (!(status_reg & MSM_BOOT_UART_DM_RXSTALE)) {
|
2015-01-13 21:46:57 +01:00
|
|
|
status_reg = readl(MSM_BOOT_UART_DM_MISR(base));
|
2014-04-09 03:45:46 +02:00
|
|
|
if (!wait)
|
|
|
|
return MSM_BOOT_UART_DM_E_RX_NOT_READY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check for Overrun error. We'll just reset Error Status */
|
2015-01-13 21:46:57 +01:00
|
|
|
if (readl(MSM_BOOT_UART_DM_SR(base)) &
|
2014-04-09 03:45:46 +02:00
|
|
|
MSM_BOOT_UART_DM_SR_UART_OVERRUN) {
|
2015-01-13 21:46:57 +01:00
|
|
|
writel(MSM_BOOT_UART_DM_CMD_RESET_ERR_STAT,
|
2014-04-09 03:45:46 +02:00
|
|
|
MSM_BOOT_UART_DM_CR(base));
|
|
|
|
total_rx_data = rx_data_read = 0;
|
|
|
|
msm_boot_uart_dm_init(base);
|
|
|
|
return MSM_BOOT_UART_DM_E_RX_NOT_READY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Read UART_DM_RX_TOTAL_SNAP for actual number of bytes received */
|
|
|
|
if (total_rx_data == 0)
|
2015-01-13 21:46:57 +01:00
|
|
|
total_rx_data = readl(MSM_BOOT_UART_DM_RX_TOTAL_SNAP(base));
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* Data available in FIFO; read a word. */
|
2015-01-13 21:46:57 +01:00
|
|
|
*data = readl(MSM_BOOT_UART_DM_RF(base, 0));
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* WAR for http://prism/CR/548280 */
|
|
|
|
if (*data == 0) {
|
|
|
|
return MSM_BOOT_UART_DM_E_RX_NOT_READY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* increment the total count of chars we've read so far */
|
|
|
|
rx_data_read += FIFO_DATA_SIZE;
|
|
|
|
|
|
|
|
/* actual count of valid data in word */
|
|
|
|
*count = ((total_rx_data < rx_data_read) ?
|
|
|
|
(FIFO_DATA_SIZE - (rx_data_read - total_rx_data)) :
|
|
|
|
FIFO_DATA_SIZE);
|
|
|
|
|
|
|
|
/* If there are still data left in FIFO we'll read them before
|
|
|
|
* initializing RX Transfer again
|
|
|
|
*/
|
|
|
|
if (rx_data_read < total_rx_data)
|
|
|
|
return MSM_BOOT_UART_DM_E_SUCCESS;
|
|
|
|
|
|
|
|
msm_boot_uart_dm_init_rx_transfer(base);
|
|
|
|
total_rx_data = rx_data_read = 0;
|
|
|
|
|
|
|
|
return MSM_BOOT_UART_DM_E_SUCCESS;
|
|
|
|
}
|
2014-04-23 23:00:59 +02:00
|
|
|
#endif
|
2014-04-09 03:45:46 +02:00
|
|
|
|
2020-09-11 15:47:09 +02:00
|
|
|
void uart_tx_byte(unsigned int idx, unsigned char data)
|
2014-04-09 03:45:46 +02:00
|
|
|
{
|
2015-01-13 21:46:57 +01:00
|
|
|
int num_of_chars = 1;
|
2019-10-24 05:45:23 +02:00
|
|
|
unsigned int tx_data = 0;
|
2015-01-13 21:46:57 +01:00
|
|
|
void *base = uart_board_param.uart_dm_base;
|
2014-04-09 03:45:46 +02:00
|
|
|
|
2014-05-28 03:03:38 +02:00
|
|
|
/* Wait until transmit FIFO is empty. */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
while (!(read32(MSM_BOOT_UART_DM_SR(base)) &
|
2015-01-13 21:46:57 +01:00
|
|
|
MSM_BOOT_UART_DM_SR_TXEMT))
|
|
|
|
udelay(1);
|
2014-05-28 03:03:38 +02:00
|
|
|
/*
|
|
|
|
* TX FIFO is ready to accept new character(s). First write number of
|
|
|
|
* characters to be transmitted.
|
|
|
|
*/
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_NO_CHARS_FOR_TX(base), num_of_chars);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
2014-05-28 03:03:38 +02:00
|
|
|
/* And now write the character(s) */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_TF(base, 0), tx_data);
|
2014-04-09 03:45:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* msm_boot_uart_dm_reset - resets UART controller
|
|
|
|
* @base: UART controller base address
|
|
|
|
*/
|
2015-01-13 21:46:57 +01:00
|
|
|
static unsigned int msm_boot_uart_dm_reset(void *base)
|
2014-04-09 03:45:46 +02:00
|
|
|
{
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_CR(base), MSM_BOOT_UART_DM_CMD_RESET_RX);
|
|
|
|
write32(MSM_BOOT_UART_DM_CR(base), MSM_BOOT_UART_DM_CMD_RESET_TX);
|
|
|
|
write32(MSM_BOOT_UART_DM_CR(base),
|
|
|
|
MSM_BOOT_UART_DM_CMD_RESET_ERR_STAT);
|
|
|
|
write32(MSM_BOOT_UART_DM_CR(base), MSM_BOOT_UART_DM_CMD_RES_TX_ERR);
|
|
|
|
write32(MSM_BOOT_UART_DM_CR(base), MSM_BOOT_UART_DM_CMD_RES_STALE_INT);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
return MSM_BOOT_UART_DM_E_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* msm_boot_uart_dm_init - initilaizes UART controller
|
|
|
|
* @uart_dm_base: UART controller base address
|
|
|
|
*/
|
2015-01-13 21:46:57 +01:00
|
|
|
static unsigned int msm_boot_uart_dm_init(void *uart_dm_base)
|
2014-04-09 03:45:46 +02:00
|
|
|
{
|
|
|
|
/* Configure UART mode registers MR1 and MR2 */
|
|
|
|
/* Hardware flow control isn't supported */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_MR1(uart_dm_base), 0x0);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* 8-N-1 configuration: 8 data bits - No parity - 1 stop bit */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_MR2(uart_dm_base),
|
|
|
|
MSM_BOOT_UART_DM_8_N_1_MODE);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* Configure Interrupt Mask register IMR */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_IMR(uart_dm_base),
|
|
|
|
MSM_BOOT_UART_DM_IMR_ENABLED);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Configure Tx and Rx watermarks configuration registers
|
|
|
|
* TX watermark value is set to 0 - interrupt is generated when
|
|
|
|
* FIFO level is less than or equal to 0
|
|
|
|
*/
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_TFWR(uart_dm_base),
|
|
|
|
MSM_BOOT_UART_DM_TFW_VALUE);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* RX watermark value */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_RFWR(uart_dm_base),
|
|
|
|
MSM_BOOT_UART_DM_RFW_VALUE);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* Configure Interrupt Programming Register */
|
|
|
|
/* Set initial Stale timeout value */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_IPR(uart_dm_base),
|
|
|
|
MSM_BOOT_UART_DM_STALE_TIMEOUT_LSB);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* Configure IRDA if required */
|
|
|
|
/* Disabling IRDA mode */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_IRDA(uart_dm_base), 0x0);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* Configure hunt character value in HCR register */
|
|
|
|
/* Keep it in reset state */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_HCR(uart_dm_base), 0x0);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Configure Rx FIFO base address
|
|
|
|
* Both TX/RX shares same SRAM and default is half-n-half.
|
|
|
|
* Sticking with default value now.
|
|
|
|
* As such RAM size is (2^RAM_ADDR_WIDTH, 32-bit entries).
|
|
|
|
* We have found RAM_ADDR_WIDTH = 0x7f
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Issue soft reset command */
|
|
|
|
msm_boot_uart_dm_reset(uart_dm_base);
|
|
|
|
|
|
|
|
/* Enable/Disable Rx/Tx DM interfaces */
|
|
|
|
/* Data Mover not currently utilized. */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_DMEN(uart_dm_base), 0x0);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* Enable transmitter */
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(MSM_BOOT_UART_DM_CR(uart_dm_base),
|
|
|
|
MSM_BOOT_UART_DM_CR_TX_ENABLE);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* Initialize Receive Path */
|
|
|
|
msm_boot_uart_dm_init_rx_transfer(uart_dm_base);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-01-13 22:07:48 +01:00
|
|
|
* ipq806x_uart_init - initializes UART
|
2014-04-09 03:45:46 +02:00
|
|
|
*
|
|
|
|
* Initializes clocks, GPIO and UART controller.
|
|
|
|
*/
|
2020-09-11 15:47:09 +02:00
|
|
|
void uart_init(unsigned int idx)
|
2014-04-09 03:45:46 +02:00
|
|
|
{
|
2014-04-23 23:00:59 +02:00
|
|
|
/* Note int idx isn't used in this driver. */
|
2015-01-13 21:46:57 +01:00
|
|
|
void *dm_base;
|
|
|
|
void *gsbi_base;
|
2014-04-09 03:45:46 +02:00
|
|
|
|
2014-04-23 23:00:59 +02:00
|
|
|
dm_base = uart_board_param.uart_dm_base;
|
2015-01-13 22:07:48 +01:00
|
|
|
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
if (read32(MSM_BOOT_UART_DM_CSR(dm_base)) == UART_DM_CLK_RX_TX_BIT_RATE)
|
2015-01-13 22:07:48 +01:00
|
|
|
return; /* UART must have been already initialized. */
|
|
|
|
|
2014-04-23 23:00:59 +02:00
|
|
|
gsbi_base = uart_board_param.uart_gsbi_base;
|
|
|
|
ipq_configure_gpio(uart_board_param.dbg_uart_gpio,
|
|
|
|
NO_OF_DBG_UART_GPIOS);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/* Configure the uart clock */
|
2015-01-13 21:46:57 +01:00
|
|
|
uart_clock_config(uart_board_param.uart_gsbi,
|
2014-04-23 23:00:59 +02:00
|
|
|
uart_board_param.mnd_value.m_value,
|
|
|
|
uart_board_param.mnd_value.n_value,
|
|
|
|
uart_board_param.mnd_value.d_value,
|
|
|
|
0);
|
2014-04-09 03:45:46 +02:00
|
|
|
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
write32(GSBI_CTRL_REG(gsbi_base),
|
|
|
|
GSBI_PROTOCOL_CODE_I2C_UART << GSBI_CTRL_REG_PROTOCOL_CODE_S);
|
|
|
|
write32(MSM_BOOT_UART_DM_CSR(dm_base), UART_DM_CLK_RX_TX_BIT_RATE);
|
2014-04-23 23:00:59 +02:00
|
|
|
|
2018-08-07 12:14:33 +02:00
|
|
|
/* Initialize UART_DM */
|
2014-04-09 03:45:46 +02:00
|
|
|
msm_boot_uart_dm_init(dm_base);
|
2014-04-23 23:00:59 +02:00
|
|
|
}
|
2014-04-09 03:45:46 +02:00
|
|
|
|
2015-01-13 22:07:48 +01:00
|
|
|
/* for the benefit of non-console uart init */
|
|
|
|
void ipq806x_uart_init(void)
|
|
|
|
{
|
|
|
|
uart_init(0);
|
|
|
|
}
|
|
|
|
|
2014-04-23 23:00:59 +02:00
|
|
|
#if 0 /* Not used yet */
|
|
|
|
uint32_t uartmem_getbaseaddr(void)
|
|
|
|
{
|
2015-01-13 21:46:57 +01:00
|
|
|
return (uint32_t)uart_board_param.uart_dm_base;
|
2014-04-09 03:45:46 +02:00
|
|
|
}
|
2014-04-23 23:00:59 +02:00
|
|
|
#endif
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/**
|
2014-04-23 23:00:59 +02:00
|
|
|
* uart_tx_flush - transmits a string of data
|
2014-04-09 03:45:46 +02:00
|
|
|
* @s: string to transmit
|
|
|
|
*/
|
2020-09-11 15:47:09 +02:00
|
|
|
void uart_tx_flush(unsigned int idx)
|
2014-04-09 03:45:46 +02:00
|
|
|
{
|
2015-01-13 21:46:57 +01:00
|
|
|
void *base = uart_board_param.uart_dm_base;
|
2014-04-23 23:00:59 +02:00
|
|
|
|
arm(64): Globally replace writel(v, a) with write32(a, v)
This patch is a raw application of the following spatch to src/:
@@
expression A, V;
@@
- writel(V, A)
+ write32(A, V)
@@
expression A, V;
@@
- writew(V, A)
+ write16(A, V)
@@
expression A, V;
@@
- writeb(V, A)
+ write8(A, V)
@@
expression A;
@@
- readl(A)
+ read32(A)
@@
expression A;
@@
- readb(A)
+ read8(A)
BRANCH=none
BUG=chromium:444723
TEST=None (depends on next patch)
Change-Id: I5dd96490c85ee2bcbc669f08bc6fff0ecc0f9e27
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 64f643da95d85954c4d4ea91c34a5c69b9b08eb6
Original-Change-Id: I366a2eb5b3a0df2279ebcce572fe814894791c42
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254864
Reviewed-on: http://review.coreboot.org/9836
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-02-19 23:51:15 +01:00
|
|
|
while (!(read32(MSM_BOOT_UART_DM_SR(base)) &
|
2014-04-23 23:00:59 +02:00
|
|
|
MSM_BOOT_UART_DM_SR_TXEMT))
|
|
|
|
;
|
2014-04-09 03:45:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-23 23:00:59 +02:00
|
|
|
* uart_can_rx_byte - checks if data available for reading
|
2014-04-09 03:45:46 +02:00
|
|
|
*
|
|
|
|
* Returns 1 if data available, 0 otherwise
|
|
|
|
*/
|
2014-04-23 23:00:59 +02:00
|
|
|
#if 0 /* Not used yet */
|
|
|
|
int uart_can_rx_byte(void)
|
2014-04-09 03:45:46 +02:00
|
|
|
{
|
|
|
|
/* Return if data is already read */
|
|
|
|
if (valid_data)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
/* Read data from the FIFO */
|
2014-04-23 23:00:59 +02:00
|
|
|
if (msm_boot_uart_dm_read(&word, &valid_data, 0) !=
|
|
|
|
MSM_BOOT_UART_DM_E_SUCCESS)
|
2014-04-09 03:45:46 +02:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2014-04-23 23:00:59 +02:00
|
|
|
#endif
|
2014-04-09 03:45:46 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ipq806x_serial_getc - reads a character
|
|
|
|
*
|
|
|
|
* Returns the character read from serial port.
|
|
|
|
*/
|
2020-09-11 15:47:09 +02:00
|
|
|
uint8_t uart_rx_byte(unsigned int idx)
|
2014-04-09 03:45:46 +02:00
|
|
|
{
|
2014-04-23 23:00:59 +02:00
|
|
|
uint8_t byte;
|
2014-04-09 03:45:46 +02:00
|
|
|
|
2014-04-23 23:00:59 +02:00
|
|
|
#if 0 /* Not used yet */
|
|
|
|
while (!uart_can_rx_byte()) {
|
2014-04-09 03:45:46 +02:00
|
|
|
/* wait for incoming data */
|
|
|
|
}
|
2014-04-23 23:00:59 +02:00
|
|
|
#endif
|
|
|
|
byte = (uint8_t)(word & 0xff);
|
2014-04-09 03:45:46 +02:00
|
|
|
word = word >> 8;
|
|
|
|
valid_data--;
|
|
|
|
|
|
|
|
return byte;
|
|
|
|
}
|
2015-01-13 22:07:48 +01:00
|
|
|
|
2014-04-23 23:00:59 +02:00
|
|
|
/* TODO: Implement fuction */
|
|
|
|
void uart_fill_lb(void *data)
|
2014-04-09 03:45:46 +02:00
|
|
|
{
|
|
|
|
}
|