[ rockchip ] clean up default patches, fix board info

This commit is contained in:
Thomas McKahan 2019-03-27 22:57:02 -04:00
parent ff9a0a3bbe
commit 5fa8d688c3
5 changed files with 9 additions and 6395 deletions

File diff suppressed because it is too large Load Diff

View File

@ -285,8 +285,8 @@ index 6e375d7ec09c..9664f71dbab2 100644
off += _emit_LP(dry_run, &buf[off], 0, lcnt0);
ljmp0 = off;
@@ -1431,11 +1427,7 @@ static inline int _setup_loops(struct pl330_dmac *pl330,
u32 ccr = pxs->ccr;
unsigned long c, bursts = BYTE_TO_BURST(x->bytes, ccr);
int num_dregs = (x->bytes - BURST_TO_BYTE(bursts, ccr)) /
BRST_SIZE(ccr);
int off = 0;
-#ifdef CONFIG_ARCH_ROCKCHIP
- if (!(pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP))
@ -474,221 +474,6 @@ index 2ba795d599fb..e5b3893d441e 100644
pxs, thrd->ev);
}
From ce768db94e3fb2c33d68ccf90001f725c0c7feb5 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Fri, 16 Jun 2017 23:14:54 +0200
Subject: [PATCH] Revert "dmaengine: pl330: redefine the cyclic transfer"
This reverts commit 5f638786e66089344c9cf594b81fbf02cd794f15.
---
drivers/dma/pl330.c | 137 +++++++++++-----------------------------------------
1 file changed, 29 insertions(+), 108 deletions(-)
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index e5b3893d441e..38c46f4e0408 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -1307,76 +1307,6 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[],
return off;
}
-/* Returns bytes consumed */
-static inline int _loop_cyclic(struct pl330_dmac *pl330, unsigned dry_run,
- u8 buf[], unsigned long bursts, const struct _xfer_spec *pxs, int ev)
-{
- int cyc, off;
- unsigned lcnt0, lcnt1, ljmp0, ljmp1, ljmpfe;
- struct _arg_LPEND lpend;
- struct pl330_xfer *x = &pxs->desc->px;
-
- off = 0;
- ljmpfe = off;
- lcnt0 = pxs->desc->num_periods;
-
- if (bursts > 256) {
- lcnt1 = 256;
- cyc = bursts / 256;
- } else {
- lcnt1 = bursts;
- cyc = 1;
- }
-
- /* forever loop */
- off += _emit_MOV(dry_run, &buf[off], SAR, x->src_addr);
- off += _emit_MOV(dry_run, &buf[off], DAR, x->dst_addr);
-
- /* loop0 */
- off += _emit_LP(dry_run, &buf[off], 0, lcnt0);
- ljmp0 = off;
-
- /* loop1 */
- off += _emit_LP(dry_run, &buf[off], 1, lcnt1);
- ljmp1 = off;
- off += _bursts(pl330, dry_run, &buf[off], pxs, cyc);
- lpend.cond = ALWAYS;
- lpend.forever = false;
- lpend.loop = 1;
- lpend.bjump = off - ljmp1;
- off += _emit_LPEND(dry_run, &buf[off], &lpend);
-
- /* remainder */
- lcnt1 = bursts - (lcnt1 * cyc);
-
- if (lcnt1) {
- off += _emit_LP(dry_run, &buf[off], 1, lcnt1);
- ljmp1 = off;
- off += _bursts(pl330, dry_run, &buf[off], pxs, 1);
- lpend.cond = ALWAYS;
- lpend.forever = false;
- lpend.loop = 1;
- lpend.bjump = off - ljmp1;
- off += _emit_LPEND(dry_run, &buf[off], &lpend);
- }
-
- off += _emit_SEV(dry_run, &buf[off], ev);
-
- lpend.cond = ALWAYS;
- lpend.forever = false;
- lpend.loop = 0;
- lpend.bjump = off - ljmp0;
- off += _emit_LPEND(dry_run, &buf[off], &lpend);
-
- lpend.cond = ALWAYS;
- lpend.forever = true;
- lpend.loop = 1;
- lpend.bjump = off - ljmpfe;
- off += _emit_LPEND(dry_run, &buf[off], &lpend);
-
- return off;
-}
-
static inline int _setup_loops(struct pl330_dmac *pl330,
unsigned dry_run, u8 buf[],
const struct _xfer_spec *pxs)
@@ -1396,16 +1326,19 @@ static inline int _setup_loops(struct pl330_dmac *pl330,
}
static inline int _setup_xfer(struct pl330_dmac *pl330,
- unsigned dry_run, u8 buf[],
+ unsigned dry_run, u8 buf[], u32 period,
const struct _xfer_spec *pxs)
{
struct pl330_xfer *x = &pxs->desc->px;
+ struct pl330_reqcfg *rqcfg = &pxs->desc->rqcfg;
int off = 0;
/* DMAMOV SAR, x->src_addr */
- off += _emit_MOV(dry_run, &buf[off], SAR, x->src_addr);
+ off += _emit_MOV(dry_run, &buf[off], SAR,
+ x->src_addr + rqcfg->src_inc * period * x->bytes);
/* DMAMOV DAR, x->dst_addr */
- off += _emit_MOV(dry_run, &buf[off], DAR, x->dst_addr);
+ off += _emit_MOV(dry_run, &buf[off], DAR,
+ x->dst_addr + rqcfg->dst_inc * period * x->bytes);
/* Setup Loop(s) */
off += _setup_loops(pl330, dry_run, &buf[off], pxs);
@@ -1427,20 +1360,6 @@ static inline int _setup_xfer(struct pl330_dmac *pl330,
return off;
}
-static inline int _setup_xfer_cyclic(struct pl330_dmac *pl330, unsigned dry_run,
- u8 buf[], const struct _xfer_spec *pxs, int ev)
-{
- struct pl330_xfer *x = &pxs->desc->px;
- u32 ccr = pxs->ccr;
- unsigned long bursts = BYTE_TO_BURST(x->bytes, ccr);
- int off = 0;
-
- /* Setup Loop(s) */
- off += _loop_cyclic(pl330, dry_run, &buf[off], bursts, pxs, ev);
-
- return off;
-}
-
/*
* A req is a sequence of one or more xfer units.
* Returns the number of bytes taken to setup the MC for the req.
@@ -1453,34 +1372,42 @@ static int _setup_req(struct pl330_dmac *pl330, unsigned dry_run,
struct pl330_xfer *x;
u8 *buf = req->mc_cpu;
int off = 0;
+ int period;
+ int again_off;
PL330_DBGMC_START(req->mc_bus);
/* DMAMOV CCR, ccr */
off += _emit_MOV(dry_run, &buf[off], CCR, pxs->ccr);
+ again_off = off;
x = &pxs->desc->px;
+ if (pl330->peripherals_req_type != BURST) {
+ /* Error if xfer length is not aligned at burst size */
+ if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr)))
+ return -EINVAL;
+ }
- if (!pxs->desc->cyclic) {
- if (pl330->peripherals_req_type != BURST) {
- /* Error if xfer length is not aligned at burst size */
- if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr)))
- return -EINVAL;
- }
-
- off += _setup_xfer(pl330, dry_run, &buf[off], pxs);
+ for (period = 0; period < pxs->desc->num_periods; period++) {
+ off += _setup_xfer(pl330, dry_run, &buf[off], period, pxs);
/* DMASEV peripheral/event */
off += _emit_SEV(dry_run, &buf[off], thrd->ev);
+ }
+
+ if (!pxs->desc->cyclic) {
/* DMAEND */
off += _emit_END(dry_run, &buf[off]);
} else {
- /* Error if xfer length is not aligned at burst size */
- if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr)))
- return -EINVAL;
-
- off += _setup_xfer_cyclic(pl330, dry_run, &buf[off],
- pxs, thrd->ev);
+ struct _arg_LPEND lpend;
+ /* LP */
+ off += _emit_LP(dry_run, &buf[off], 0, 255);
+ /* LPEND */
+ lpend.cond = ALWAYS;
+ lpend.forever = false;
+ lpend.loop = 0;
+ lpend.bjump = off - again_off;
+ off += _emit_LPEND(dry_run, &buf[off], &lpend);
}
return off;
@@ -2655,7 +2582,6 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
{
struct dma_pl330_desc *desc = NULL;
struct dma_pl330_chan *pch = to_pchan(chan);
- struct pl330_dmac *pl330 = pch->dmac;
dma_addr_t dst;
dma_addr_t src;
@@ -2694,12 +2620,7 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
desc->rqtype = direction;
desc->rqcfg.brst_size = pch->burst_sz;
-
- if (pl330->peripherals_req_type == BURST)
- desc->rqcfg.brst_len = pch->burst_len;
- else
- desc->rqcfg.brst_len = 1;
-
+ desc->rqcfg.brst_len = pch->burst_len;
desc->bytes_requested = len;
fill_px(&desc->px, dst, src, period_len);
From 8ad1819a2e61483c3840d09b9a27f669c7fcb8bc Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Fri, 16 Jun 2017 23:14:54 +0200

View File

@ -1,68 +0,0 @@
From a82c6733b2a61e20ea9921fc871f7f0eefd8cb56 Mon Sep 17 00:00:00 2001
From: tom_shen <tom_shen@asus.com>
Date: Wed, 5 Jul 2017 10:51:37 +0800
Subject: [PATCH] Fix "000000.." serial number of cpu by /proc/cpuinfo
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Change-Id: I51764bcfa8015a004319a1ddd6fd02a4a1153678
Reviewed-on: https://tp-biosrd-v02/gerrit/80049
Reviewed-by: Jamess Huang(黃以民) <Jamess_Huang@asus.com>
Tested-by: Jamess Huang(黃以民) <Jamess_Huang@asus.com>
---
drivers/nvmem/rockchip-efuse.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c
index 9fcfedf3200e..820db7e111f4 100644
--- a/drivers/nvmem/rockchip-efuse.c
+++ b/drivers/nvmem/rockchip-efuse.c
@@ -23,6 +23,8 @@
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/rockchip/rockchip_sip.h>
+#include <asm/system_info.h>
+#include <linux/crc32.h>
#define RK3128_A_SHIFT 7
#define RK3288_A_SHIFT 6
@@ -93,12 +95,26 @@ static const struct of_device_id rockchip_efuse_match[] = {
{ /* sentinel */},
};
MODULE_DEVICE_TABLE(of, rockchip_efuse_match);
+static u8 efuse_buf[32] = {};
+static void rk3288_set_system_serial(void) {
+ int i;
+ u8 buf[16];
+
+ for (i = 0; i < 8; i++) {
+ buf[i] = efuse_buf[8 + (i << 1)];
+ buf[i + 8] = efuse_buf[7 + (i << 1)];
+ }
+
+ system_serial_low = crc32(0, buf, 8);
+ system_serial_high = crc32(system_serial_low, buf + 8, 8);
+}
static int __init rockchip_efuse_probe(struct platform_device *pdev)
{
struct resource *res;
struct nvmem_device *nvmem;
struct rockchip_efuse_chip *efuse;
+ int ret;
const struct of_device_id *match;
struct device *dev = &pdev->dev;
@@ -124,6 +140,11 @@ static int __init rockchip_efuse_probe(struct platform_device *pdev)
return PTR_ERR(nvmem);
platform_set_drvdata(pdev, nvmem);
+ ret = rockchip_efuse_read(efuse, 0, efuse_buf, 32);
+ if (ret < 0) {
+ printk(" failed to rockchip_efuse_read\n");
+ }
+ rk3288_set_system_serial();
return 0;
}

View File

@ -23,13 +23,16 @@ Tested-by: Alex Cheng(鄭富元) <Alex_Cheng@asus.com>
create mode 100644 drivers/board-info/board-info.c
diff --git a/drivers/Makefile b/drivers/Makefile
index 5690f93711e5..815530618e06 100644
index 4d00308c..a2a82b39 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -178,3 +178,4 @@ obj-$(CONFIG_RK_NAND) += rk_nand/
obj-$(CONFIG_RK_HEADSET) += headset_observe/
@@ -181,4 +181,5 @@ obj-$(CONFIG_RK_HEADSET) += headset_observe/
obj-$(CONFIG_RK_FLASH) += rkflash/
obj-y += rk_nand/
obj-y += tinkerboard/
-obj-y += tinkerboard/
\ No newline at end of file
+obj-y += tinkerboard/
+obj-y += board-info/
diff --git a/drivers/board-info/Makefile b/drivers/board-info/Makefile
new file mode 100644