summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-03-04 16:30:33 +0000
committerAidan MacDonald <amachronic@protonmail.com>2022-03-25 21:36:51 +0000
commit7cb49cfb33647941d4a706675832bfc57a4e27cf (patch)
treebc558b9be3f8ca856adafe6b00af45e87adb6679 /firmware
parentbd8cd58568a845b876861e81af9f13a07f563060 (diff)
downloadrockbox-7cb49cfb33647941d4a706675832bfc57a4e27cf.tar.gz
rockbox-7cb49cfb33647941d4a706675832bfc57a4e27cf.zip
x1000: spl: split off NAND storage to separate file
Just tidying. No functional changes. Change-Id: I8aa85c789d1a6bd357797c6c95e38a7325eba809
Diffstat (limited to 'firmware')
-rw-r--r--firmware/SOURCES3
-rw-r--r--firmware/target/mips/ingenic_x1000/spl-nand-x1000.c50
-rw-r--r--firmware/target/mips/ingenic_x1000/spl-x1000.c25
3 files changed, 53 insertions, 25 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index b72a7521e9..6c8f7b957c 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -1711,6 +1711,7 @@ target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c
1711target/mips/ingenic_x1000/fiiom3k/lcd-fiiom3k.c 1711target/mips/ingenic_x1000/fiiom3k/lcd-fiiom3k.c
1712target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c 1712target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c
1713target/mips/ingenic_x1000/fiiom3k/spl-fiiom3k.c 1713target/mips/ingenic_x1000/fiiom3k/spl-fiiom3k.c
1714target/mips/ingenic_x1000/spl-nand-x1000.c
1714#endif /* FIIO_M3K */ 1715#endif /* FIIO_M3K */
1715 1716
1716#if defined(SHANLING_Q1) 1717#if defined(SHANLING_Q1)
@@ -1720,6 +1721,7 @@ target/mips/ingenic_x1000/shanlingq1/button-shanlingq1.c
1720target/mips/ingenic_x1000/shanlingq1/lcd-shanlingq1.c 1721target/mips/ingenic_x1000/shanlingq1/lcd-shanlingq1.c
1721target/mips/ingenic_x1000/shanlingq1/power-shanlingq1.c 1722target/mips/ingenic_x1000/shanlingq1/power-shanlingq1.c
1722target/mips/ingenic_x1000/shanlingq1/spl-shanlingq1.c 1723target/mips/ingenic_x1000/shanlingq1/spl-shanlingq1.c
1724target/mips/ingenic_x1000/spl-nand-x1000.c
1723#endif /* SHANLING_Q1 */ 1725#endif /* SHANLING_Q1 */
1724 1726
1725#if defined(EROS_QN) 1727#if defined(EROS_QN)
@@ -1729,6 +1731,7 @@ target/mips/ingenic_x1000/erosqnative/button-erosqnative.c
1729target/mips/ingenic_x1000/erosqnative/lcd-erosqnative.c 1731target/mips/ingenic_x1000/erosqnative/lcd-erosqnative.c
1730target/mips/ingenic_x1000/erosqnative/power-erosqnative.c 1732target/mips/ingenic_x1000/erosqnative/power-erosqnative.c
1731target/mips/ingenic_x1000/erosqnative/spl-erosqnative.c 1733target/mips/ingenic_x1000/erosqnative/spl-erosqnative.c
1734target/mips/ingenic_x1000/spl-nand-x1000.c
1732#endif /* EROS_QN */ 1735#endif /* EROS_QN */
1733 1736
1734#if defined(LYRE_PROTO1) 1737#if defined(LYRE_PROTO1)
diff --git a/firmware/target/mips/ingenic_x1000/spl-nand-x1000.c b/firmware/target/mips/ingenic_x1000/spl-nand-x1000.c
new file mode 100644
index 0000000000..82a05abf75
--- /dev/null
+++ b/firmware/target/mips/ingenic_x1000/spl-nand-x1000.c
@@ -0,0 +1,50 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2021 Aidan MacDonald
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "spl-x1000.h"
23#include "gpio-x1000.h"
24#include "nand-x1000.h"
25
26static nand_drv* ndrv = NULL;
27
28int spl_storage_open(void)
29{
30 /* We need to assign the GPIOs manually */
31 gpioz_configure(GPIO_A, 0x3f << 26, GPIOF_DEVICE(1));
32
33 /* Allocate NAND driver manually in DRAM */
34 ndrv = spl_alloc(sizeof(nand_drv));
35 ndrv->page_buf = spl_alloc(NAND_DRV_MAXPAGESIZE);
36 ndrv->scratch_buf = spl_alloc(NAND_DRV_SCRATCHSIZE);
37 ndrv->refcount = 0;
38
39 return nand_open(ndrv);
40}
41
42void spl_storage_close(void)
43{
44 nand_close(ndrv);
45}
46
47int spl_storage_read(uint32_t addr, uint32_t length, void* buffer)
48{
49 return nand_read_bytes(ndrv, addr, length, buffer);
50}
diff --git a/firmware/target/mips/ingenic_x1000/spl-x1000.c b/firmware/target/mips/ingenic_x1000/spl-x1000.c
index 499b46ce62..ac3a17f69f 100644
--- a/firmware/target/mips/ingenic_x1000/spl-x1000.c
+++ b/firmware/target/mips/ingenic_x1000/spl-x1000.c
@@ -47,7 +47,6 @@
47#endif 47#endif
48 48
49static void* heap = (void*)(X1000_SDRAM_BASE + X1000_SDRAM_SIZE); 49static void* heap = (void*)(X1000_SDRAM_BASE + X1000_SDRAM_SIZE);
50static nand_drv* ndrv = NULL;
51 50
52void* spl_alloc(size_t count) 51void* spl_alloc(size_t count)
53{ 52{
@@ -56,30 +55,6 @@ void* spl_alloc(size_t count)
56 return heap; 55 return heap;
57} 56}
58 57
59int spl_storage_open(void)
60{
61 /* We need to assign the GPIOs manually */
62 gpioz_configure(GPIO_A, 0x3f << 26, GPIOF_DEVICE(1));
63
64 /* Allocate NAND driver manually in DRAM */
65 ndrv = spl_alloc(sizeof(nand_drv));
66 ndrv->page_buf = spl_alloc(NAND_DRV_MAXPAGESIZE);
67 ndrv->scratch_buf = spl_alloc(NAND_DRV_SCRATCHSIZE);
68 ndrv->refcount = 0;
69
70 return nand_open(ndrv);
71}
72
73void spl_storage_close(void)
74{
75 nand_close(ndrv);
76}
77
78int spl_storage_read(uint32_t addr, uint32_t length, void* buffer)
79{
80 return nand_read_bytes(ndrv, addr, length, buffer);
81}
82
83/* Used by: 58/* Used by:
84 * - FiiO M3K 59 * - FiiO M3K
85 * - Shanling Q1 60 * - Shanling Q1