Skip to contentSkip to conversation

serial: 16550: Add getfcr accessor

PATCH New Marek Vasut 5 participants 41 messages Dec 1, 2016 – Jun 12, 2017

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/13 serial: 16550: Add getfcr accessor

Add function which allows fetching the default FCR register setting from platform data for DM , while retaining old behavior for non-DM by returning UART_FCRVAL.

---
V2: If CONFIG_DM_SERIAL and DEBUG_UART are enabled, the ns16550_getfcr()
can be invoked with NULL plat data . Check for this case and return the default UART_FCRVAL then.
V3: It turns out that if DEBUG_UART is defined, $port points directly to
hardware registers. Add additional ifdef to handle the case where debug uart is enabled with DM_SERIAL correctly.
V4: Use UART_FCRVAL in _debug_uart_init() directly

---
 drivers/serial/ns16550.c | 18 ++++++++++++++++--
 include/ns16550.h        |  1 +
 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/serial/ns16550.c +16 -2
index 6e9b946..3c9f3b0 100644
@@ -121,6 +121,13 @@ static int ns16550_readb(NS16550_t port, int offset)
 	return serial_in_shift(addr + plat->reg_offset, plat->reg_shift);
 }
 
+static u32 ns16550_getfcr(NS16550_t port)
+{
+	struct ns16550_platdata *plat = port->plat;
+
+	return plat->fcr;
+}
+
 /* We can clean these up once everything is moved to driver model */
 #define serial_out(value, addr)	\
 	ns16550_writeb(com_port, \
@@ -128,6 +135,11 @@ static int ns16550_readb(NS16550_t port, int offset)
 #define serial_in(addr) \
 	ns16550_readb(com_port, \
 		(unsigned char *)addr - (unsigned char *)com_port)
+#else
+static u32 ns16550_getfcr(NS16550_t port)
+{
+	return UART_FCRVAL;
+}
 #endif
 
 int ns16550_calc_divisor(NS16550_t port, int clock, int baudrate)
@@ -171,7 +183,7 @@ void NS16550_init(NS16550_t com_port, int baud_divisor)
 	serial_out(0x7, &com_port->mdr1);	/* mode select reset TL16C750*/
 #endif
 	serial_out(UART_MCRVAL, &com_port->mcr);
-	serial_out(UART_FCRVAL, &com_port->fcr);
+	serial_out(ns16550_getfcr(com_port), &com_port->fcr);
 	if (baud_divisor != -1)
 		NS16550_setbrg(com_port, baud_divisor);
 #if defined(CONFIG_OMAP) || \
@@ -192,7 +204,7 @@ void NS16550_reinit(NS16550_t com_port, int baud_divisor)
 	serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
 	NS16550_setbrg(com_port, 0);
 	serial_out(UART_MCRVAL, &com_port->mcr);
-	serial_out(UART_FCRVAL, &com_port->fcr);
+	serial_out(ns16550_getfcr(com_port), &com_port->fcr);
 	NS16550_setbrg(com_port, baud_divisor);
 }
 #endif /* CONFIG_NS16550_MIN_FUNCTIONS */
@@ -420,6 +432,8 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
 		return -EINVAL;
 	}
 
+	plat->fcr = UART_FCRVAL;
+
 	return 0;
 }
 #endif
include/ns16550.h +1 -0
index 1311f4c..45fd68b 100644
@@ -57,6 +57,7 @@ struct ns16550_platdata {
 	int reg_shift;
 	int clock;
 	int reg_offset;
+	u32 fcr;
 };
 
 struct udevice;
Signature · 1 line
2.10.2
#1 lore raw

PATCH 2/13 serial: 16550: Add port type as driver data

Add driver data to each compatible string to identify the type of the port. Since all the ports in the driver are entirely compatible with 16550 for now, all are marked with PORT_NS16550. But, there are ports which have specific quirks, like the JZ4780 UART, which do not have any DT property to denote the quirks. Instead, Linux uses the compatible string to discern such ports and enable the necessary quirks.

---
 drivers/serial/ns16550.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)
drivers/serial/ns16550.c +16 -10
index 3c9f3b0..3130a1d 100644
@@ -360,6 +360,12 @@ int ns16550_serial_probe(struct udevice *dev)
 	return 0;
 }
 
+#if CONFIG_IS_ENABLED(OF_CONTROL)
+enum {
+	PORT_NS16550 = 0,
+};
+#endif
+
 #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
 {
@@ -453,16 +459,16 @@ const struct dm_serial_ops ns16550_serial_ops = {
  * compatible string to your dts.
  */
 static const struct udevice_id ns16550_serial_ids[] = {
-	{ .compatible = "ns16550" },
-	{ .compatible = "ns16550a" },
-	{ .compatible = "nvidia,tegra20-uart" },
-	{ .compatible = "snps,dw-apb-uart" },
-	{ .compatible = "ti,omap2-uart" },
-	{ .compatible = "ti,omap3-uart" },
-	{ .compatible = "ti,omap4-uart" },
-	{ .compatible = "ti,am3352-uart" },
-	{ .compatible = "ti,am4372-uart" },
-	{ .compatible = "ti,dra742-uart" },
+	{ .compatible = "ns16550",		.data = PORT_NS16550 },
+	{ .compatible = "ns16550a",		.data = PORT_NS16550 },
+	{ .compatible = "nvidia,tegra20-uart",	.data = PORT_NS16550 },
+	{ .compatible = "snps,dw-apb-uart",	.data = PORT_NS16550 },
+	{ .compatible = "ti,omap2-uart",	.data = PORT_NS16550 },
+	{ .compatible = "ti,omap3-uart",	.data = PORT_NS16550 },
+	{ .compatible = "ti,omap4-uart",	.data = PORT_NS16550 },
+	{ .compatible = "ti,am3352-uart",	.data = PORT_NS16550 },
+	{ .compatible = "ti,am4372-uart",	.data = PORT_NS16550 },
+	{ .compatible = "ti,dra742-uart",	.data = PORT_NS16550 },
 	{}
 };
 #endif
Signature · 1 line
2.10.2
#2 lore raw

PATCH 2/13 serial: 16550: Add port type as driver data

Quoted 11 lines · Marek Vasut

Add driver data to each compatible string to identify the type of the port. Since all the ports in the driver are entirely compatible with 16550 for now, all are marked with PORT_NS16550. But, there are ports which have specific quirks, like the JZ4780 UART, which do not have any DT property to denote the quirks. Instead, Linux uses the compatible string to discern such ports and enable the necessary quirks.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161219/07c4b3fe/attachment.sig>
#3 lore raw

PATCH 3/13 serial: 16550: Add Ingenic JZ4780 support

In reply to Marek Vasut

Add compatibility string for the Ingenic JZ4780 SoC, the necessary UART enable bit into FCR and register shift. Neither are encoded in the DTS coming from Linux, so we need to support it this way.

Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>

---
V2: Drop the reg_shift and move it to OF

---
 drivers/serial/ns16550.c | 5 +++++
 include/ns16550.h        | 3 +++
 2 files changed, 8 insertions(+)
drivers/serial/ns16550.c +5 -0
index 3130a1d..9b423a5 100644
@@ -363,6 +363,7 @@ int ns16550_serial_probe(struct udevice *dev)
 #if CONFIG_IS_ENABLED(OF_CONTROL)
 enum {
 	PORT_NS16550 = 0,
+	PORT_JZ4780,
 };
 #endif
 
@@ -370,6 +371,7 @@ enum {
 int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
 {
 	struct ns16550_platdata *plat = dev->platdata;
+	const u32 port_type = dev_get_driver_data(dev);
 	fdt_addr_t addr;
 	struct clk clk;
 	int err;
@@ -439,6 +441,8 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
 	}
 
 	plat->fcr = UART_FCRVAL;
+	if (port_type == PORT_JZ4780)
+		plat->fcr |= UART_FCR_UME;
 
 	return 0;
 }
@@ -461,6 +465,7 @@ const struct dm_serial_ops ns16550_serial_ops = {
 static const struct udevice_id ns16550_serial_ids[] = {
 	{ .compatible = "ns16550",		.data = PORT_NS16550 },
 	{ .compatible = "ns16550a",		.data = PORT_NS16550 },
+	{ .compatible = "ingenic,jz4780-uart",	.data = PORT_JZ4780  },
 	{ .compatible = "nvidia,tegra20-uart",	.data = PORT_NS16550 },
 	{ .compatible = "snps,dw-apb-uart",	.data = PORT_NS16550 },
 	{ .compatible = "ti,omap2-uart",	.data = PORT_NS16550 },
include/ns16550.h +3 -0
index 45fd68b..7c97036 100644
@@ -118,6 +118,9 @@ typedef struct NS16550 *NS16550_t;
 #define UART_FCR_RXSR		0x02 /* Receiver soft reset */
 #define UART_FCR_TXSR		0x04 /* Transmitter soft reset */
 
+/* Ingenic JZ47xx specific UART-enable bit. */
+#define UART_FCR_UME		0x10
+
 /*
  * These are the definitions for the Modem Control Register
  */
Signature · 1 line
2.10.2
#4 lore raw

PATCH 3/13 serial: 16550: Add Ingenic JZ4780 support

Quoted 9 lines · Marek Vasut

Add compatibility string for the Ingenic JZ4780 SoC, the necessary UART enable bit into FCR and register shift. Neither are encoded in the DTS coming from Linux, so we need to support it this way.

Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
Quoted 6 lines

---
V2: Drop the reg_shift and move it to OF

---
 drivers/serial/ns16550.c | 5 +++++
 include/ns16550.h        | 3 +++
 2 files changed, 8 insertions(+)
#5 lore raw

PATCH 3/13 serial: 16550: Add Ingenic JZ4780 support

In reply to Marek Vasut
Quoted 10 lines · Marek Vasut

Add compatibility string for the Ingenic JZ4780 SoC, the necessary UART enable bit into FCR and register shift. Neither are encoded in the DTS coming from Linux, so we need to support it this way.

Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161219/46b743b2/attachment.sig>
#6 lore raw

PATCH 4/13 mmc: Fix warning if debug() is not used

In reply to Marek Vasut

If debug() is not used, then the whole content of debug(...) will be removed by the preprocessor, which will result in the following warning. This patch adds __maybe_unused annotation to fix this.

drivers/mmc/mmc.c: In function ?mmc_init?:
drivers/mmc/mmc.c:1685:11: warning: variable ?start? set but not used [-Wunused-but-set-variable]
unsigned start;

Cc Pantelis Antoniou <[email protected]>
Cc Tom Rini <[email protected]>
Cc Jaehoon Chung <[email protected]>
---
 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mmc.c +1 -1
index d6b7e4f..6e25b67 100644
@@ -1708,7 +1708,7 @@ static int mmc_complete_init(struct mmc *mmc)
 int mmc_init(struct mmc *mmc)
 {
 	int err = 0;
-	unsigned start;
+	__maybe_unused unsigned start;
 #ifdef CONFIG_DM_MMC
 	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(mmc->dev);
 
Signature · 1 line
2.10.2
#7 lore raw

PATCH 4/13 mmc: Fix warning if debug() is not used

Quoted 4 lines · Marek Vasut

If debug() is not used, then the whole content of debug(...) will be removed by the preprocessor, which will result in the following warning. This patch adds __maybe_unused annotation to fix this.

Quoted 8 lines

drivers/mmc/mmc.c: In function ?mmc_init?:
drivers/mmc/mmc.c:1685:11: warning: variable ?start? set but not used [-Wunused-but-set-variable]
unsigned start;

Cc Pantelis Antoniou <[email protected]>
Cc Tom Rini <[email protected]>
Cc Jaehoon Chung <[email protected]>

I think that is not related to other patches.
So i will this patch into u-boot-mmc. with Tom's Reviewd-by tag. (And also PATCH[04/13]~PATCH[07/13]) how about?
I'm doing the build testing now. If you have any other opinion, let me know, plz.

Best Regards,
Jaehoon Chung

Quoted 18 lines
---
 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mmc.c +1 -1
index d6b7e4f..6e25b67 100644
@@ -1708,7 +1708,7 @@ static int mmc_complete_init(struct mmc *mmc)
 int mmc_init(struct mmc *mmc)
 {
 	int err = 0;
-	unsigned start;
+	__maybe_unused unsigned start;
 #ifdef CONFIG_DM_MMC
 	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(mmc->dev);
 
#8 lore raw

PATCH 4/13 mmc: Fix warning if debug() is not used

In reply to Marek Vasut
Quoted 4 lines · Marek Vasut

If debug() is not used, then the whole content of debug(...) will be removed by the preprocessor, which will result in the following warning. This patch adds __maybe_unused annotation to fix this.

Quoted 8 lines

drivers/mmc/mmc.c: In function ?mmc_init?:
drivers/mmc/mmc.c:1685:11: warning: variable ?start? set but not used [-Wunused-but-set-variable]
unsigned start;

Cc Pantelis Antoniou <[email protected]>
Cc Tom Rini <[email protected]>
Cc Jaehoon Chung <[email protected]>

Applied on u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung

Quoted 18 lines
---
 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mmc.c +1 -1
index d6b7e4f..6e25b67 100644
@@ -1708,7 +1708,7 @@ static int mmc_complete_init(struct mmc *mmc)
 int mmc_init(struct mmc *mmc)
 {
 	int err = 0;
-	unsigned start;
+	__maybe_unused unsigned start;
 #ifdef CONFIG_DM_MMC
 	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(mmc->dev);
 
#9 lore raw

PATCH 5/13 mmc: Tinification of the mmc code

In reply to Marek Vasut

Add new configuration option CONFIG_MMC_TINY which strips away all memory allocation within the MMC code and code for handling multiple cards. This allows extremely space-constrained SPL code use the MMC framework.

Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Jaehoon Chung <[email protected]>

---
V2: Switch the MMC_TINY option to Kconfig

---
 common/spl/spl_mmc.c     |  6 +++++-
 drivers/mmc/Kconfig      | 15 +++++++++++++++
 drivers/mmc/mmc.c        | 31 ++++++++++++++++++++++++++++++-
 drivers/mmc/mmc_legacy.c | 32 ++++++++++++++++++++++++++++++++
 include/mmc.h            |  1 +
 5 files changed, 83 insertions(+), 2 deletions(-)
common/spl/spl_mmc.c +5 -1
index a3d6b36..7dfcd0b 100644
@@ -306,7 +306,11 @@ static int spl_mmc_load_image(struct spl_image_info *spl_image,
 			if (part == 7)
 				part = 0;
 
-			err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
+			if (CONFIG_IS_ENABLED(MMC_TINY))
+				err = mmc_switch_part(mmc, part);
+			else
+				err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
+
 			if (err) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 				puts("spl: mmc partition switch failed\n");
drivers/mmc/Kconfig +15 -0
index 24f4b28..5e84a41 100644
@@ -26,6 +26,21 @@ config DM_MMC_OPS
 	  option will be removed as soon as all DM_MMC drivers use it, as it
 	  will the only supported behaviour.
 
+config SPL_MMC_TINY
+	bool "Tiny MMC framework in SPL"
+	help
+	  Enable MMC framework tinification support. This option is useful if
+	  if your SPL is extremely size constrained. Heed the warning, enable
+	  this option if and only if you know exactly what you are doing, if
+	  you are reading this help text, you most likely have no idea :-)
+
+	  The MMC framework is reduced to bare minimum to be useful. No malloc
+	  support is needed for the MMC framework operation with this option
+	  enabled. The framework supports exactly one MMC device and exactly
+	  one MMC driver. The MMC driver can be adjusted to avoid any malloc
+	  operations too, which can remove the need for malloc support in SPL
+	  and thus further reduce footprint.
+
 config MSM_SDHCI
 	bool "Qualcomm SDHCI controller"
 	depends on DM_MMC && BLK && DM_MMC_OPS
drivers/mmc/mmc.c +30 -1
index 6e25b67..19c4225 100644
@@ -30,6 +30,29 @@ static const unsigned int sd_au_size[] = {
 	SZ_16M / 512,	(SZ_16M + SZ_8M) / 512,	SZ_32M / 512,	SZ_64M / 512,
 };
 
+#if CONFIG_IS_ENABLED(MMC_TINY)
+static struct mmc mmc_static;
+struct mmc *find_mmc_device(int dev_num)
+{
+	return &mmc_static;
+}
+
+void mmc_do_preinit(void)
+{
+	struct mmc *m = &mmc_static;
+#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
+	mmc_set_preinit(m, 1);
+#endif
+	if (m->preinit)
+		mmc_start_init(m);
+}
+
+struct blk_desc *mmc_get_blk_desc(struct mmc *mmc)
+{
+	return &mmc->block_dev;
+}
+#endif
+
 #ifndef CONFIG_DM_MMC_OPS
 __weak int board_mmc_getwp(struct mmc *mmc)
 {
@@ -259,7 +282,11 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 	if (!mmc)
 		return 0;
 
-	err = blk_dselect_hwpart(block_dev, block_dev->hwpart);
+	if (CONFIG_IS_ENABLED(MMC_TINY))
+		err = mmc_switch_part(mmc, block_dev->hwpart);
+	else
+		err = blk_dselect_hwpart(block_dev, block_dev->hwpart);
+
 	if (err < 0)
 		return 0;
 
@@ -1804,8 +1831,10 @@ int mmc_initialize(bd_t *bis)
 	initialized = 1;
 
 #ifndef CONFIG_BLK
+#if !CONFIG_IS_ENABLED(MMC_TINY)
 	mmc_list_init();
 #endif
+#endif
 	ret = mmc_probe(bis);
 	if (ret)
 		return ret;
drivers/mmc/mmc_legacy.c +32 -0
index 25361d1..bdf9d98 100644
@@ -13,6 +13,7 @@
 static struct list_head mmc_devices;
 static int cur_dev_num = -1;
 
+#if !CONFIG_IS_ENABLED(MMC_TINY)
 struct mmc *find_mmc_device(int dev_num)
 {
 	struct mmc *m;
@@ -62,6 +63,7 @@ void mmc_do_preinit(void)
 			mmc_start_init(m);
 	}
 }
+#endif
 
 void mmc_list_init(void)
 {
@@ -109,6 +111,35 @@ void print_mmc_devices(char separator)
 void print_mmc_devices(char separator) { }
 #endif
 
+#if CONFIG_IS_ENABLED(MMC_TINY)
+static struct mmc mmc_static = {
+	.dsr_imp		= 0,
+	.dsr			= 0xffffffff,
+	.block_dev = {
+		.if_type	= IF_TYPE_MMC,
+		.removable	= 1,
+		.devnum		= 0,
+		.block_read	= mmc_bread,
+		.block_write	= mmc_bwrite,
+		.block_erase	= mmc_berase,
+		.part_type	= 0,
+	},
+};
+
+struct mmc *mmc_create(const struct mmc_config *cfg, void *priv)
+{
+	struct mmc *mmc = &mmc_static;
+
+	mmc->cfg = cfg;
+	mmc->priv = priv;
+
+	return mmc;
+}
+
+void mmc_destroy(struct mmc *mmc)
+{
+}
+#else
 struct mmc *mmc_create(const struct mmc_config *cfg, void *priv)
 {
 	struct blk_desc *bdesc;
@@ -157,6 +188,7 @@ void mmc_destroy(struct mmc *mmc)
 	/* only freeing memory for now */
 	free(mmc);
 }
+#endif
 
 static int mmc_select_hwpartp(struct blk_desc *desc, int hwpart)
 {
include/mmc.h +1 -0
index e815eb3..f39be3c 100644
@@ -513,6 +513,7 @@ void print_mmc_devices(char separator);
  * @return 0 if there is no MMC device, else the number of devices
  */
 int get_mmc_num(void);
+int mmc_switch_part(struct mmc *mmc, unsigned int part_num);
 int mmc_hwpart_config(struct mmc *mmc, const struct mmc_hwpart_conf *conf,
 		      enum mmc_hwpart_conf_mode mode);
 
Signature · 1 line
2.10.2
#10 lore raw

PATCH 5/13 mmc: Tinification of the mmc code

Quoted 9 lines · Marek Vasut

Add new configuration option CONFIG_MMC_TINY which strips away all memory allocation within the MMC code and code for handling multiple cards. This allows extremely space-constrained SPL code use the MMC framework.

Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Jaehoon Chung <[email protected]>

Applied on u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung

Quoted 188 lines

---
V2: Switch the MMC_TINY option to Kconfig

---
 common/spl/spl_mmc.c     |  6 +++++-
 drivers/mmc/Kconfig      | 15 +++++++++++++++
 drivers/mmc/mmc.c        | 31 ++++++++++++++++++++++++++++++-
 drivers/mmc/mmc_legacy.c | 32 ++++++++++++++++++++++++++++++++
 include/mmc.h            |  1 +
 5 files changed, 83 insertions(+), 2 deletions(-)
common/spl/spl_mmc.c +5 -1
index a3d6b36..7dfcd0b 100644
@@ -306,7 +306,11 @@ static int spl_mmc_load_image(struct spl_image_info *spl_image,
 			if (part == 7)
 				part = 0;
 
-			err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
+			if (CONFIG_IS_ENABLED(MMC_TINY))
+				err = mmc_switch_part(mmc, part);
+			else
+				err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
+
 			if (err) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 				puts("spl: mmc partition switch failed\n");
drivers/mmc/Kconfig +15 -0
index 24f4b28..5e84a41 100644
@@ -26,6 +26,21 @@ config DM_MMC_OPS
 	  option will be removed as soon as all DM_MMC drivers use it, as it
 	  will the only supported behaviour.
 
+config SPL_MMC_TINY
+	bool "Tiny MMC framework in SPL"
+	help
+	  Enable MMC framework tinification support. This option is useful if
+	  if your SPL is extremely size constrained. Heed the warning, enable
+	  this option if and only if you know exactly what you are doing, if
+	  you are reading this help text, you most likely have no idea :-)
+
+	  The MMC framework is reduced to bare minimum to be useful. No malloc
+	  support is needed for the MMC framework operation with this option
+	  enabled. The framework supports exactly one MMC device and exactly
+	  one MMC driver. The MMC driver can be adjusted to avoid any malloc
+	  operations too, which can remove the need for malloc support in SPL
+	  and thus further reduce footprint.
+
 config MSM_SDHCI
 	bool "Qualcomm SDHCI controller"
 	depends on DM_MMC && BLK && DM_MMC_OPS
drivers/mmc/mmc.c +30 -1
index 6e25b67..19c4225 100644
@@ -30,6 +30,29 @@ static const unsigned int sd_au_size[] = {
 	SZ_16M / 512,	(SZ_16M + SZ_8M) / 512,	SZ_32M / 512,	SZ_64M / 512,
 };
 
+#if CONFIG_IS_ENABLED(MMC_TINY)
+static struct mmc mmc_static;
+struct mmc *find_mmc_device(int dev_num)
+{
+	return &mmc_static;
+}
+
+void mmc_do_preinit(void)
+{
+	struct mmc *m = &mmc_static;
+#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
+	mmc_set_preinit(m, 1);
+#endif
+	if (m->preinit)
+		mmc_start_init(m);
+}
+
+struct blk_desc *mmc_get_blk_desc(struct mmc *mmc)
+{
+	return &mmc->block_dev;
+}
+#endif
+
 #ifndef CONFIG_DM_MMC_OPS
 __weak int board_mmc_getwp(struct mmc *mmc)
 {
@@ -259,7 +282,11 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 	if (!mmc)
 		return 0;
 
-	err = blk_dselect_hwpart(block_dev, block_dev->hwpart);
+	if (CONFIG_IS_ENABLED(MMC_TINY))
+		err = mmc_switch_part(mmc, block_dev->hwpart);
+	else
+		err = blk_dselect_hwpart(block_dev, block_dev->hwpart);
+
 	if (err < 0)
 		return 0;
 
@@ -1804,8 +1831,10 @@ int mmc_initialize(bd_t *bis)
 	initialized = 1;
 
 #ifndef CONFIG_BLK
+#if !CONFIG_IS_ENABLED(MMC_TINY)
 	mmc_list_init();
 #endif
+#endif
 	ret = mmc_probe(bis);
 	if (ret)
 		return ret;
drivers/mmc/mmc_legacy.c +32 -0
index 25361d1..bdf9d98 100644
@@ -13,6 +13,7 @@
 static struct list_head mmc_devices;
 static int cur_dev_num = -1;
 
+#if !CONFIG_IS_ENABLED(MMC_TINY)
 struct mmc *find_mmc_device(int dev_num)
 {
 	struct mmc *m;
@@ -62,6 +63,7 @@ void mmc_do_preinit(void)
 			mmc_start_init(m);
 	}
 }
+#endif
 
 void mmc_list_init(void)
 {
@@ -109,6 +111,35 @@ void print_mmc_devices(char separator)
 void print_mmc_devices(char separator) { }
 #endif
 
+#if CONFIG_IS_ENABLED(MMC_TINY)
+static struct mmc mmc_static = {
+	.dsr_imp		= 0,
+	.dsr			= 0xffffffff,
+	.block_dev = {
+		.if_type	= IF_TYPE_MMC,
+		.removable	= 1,
+		.devnum		= 0,
+		.block_read	= mmc_bread,
+		.block_write	= mmc_bwrite,
+		.block_erase	= mmc_berase,
+		.part_type	= 0,
+	},
+};
+
+struct mmc *mmc_create(const struct mmc_config *cfg, void *priv)
+{
+	struct mmc *mmc = &mmc_static;
+
+	mmc->cfg = cfg;
+	mmc->priv = priv;
+
+	return mmc;
+}
+
+void mmc_destroy(struct mmc *mmc)
+{
+}
+#else
 struct mmc *mmc_create(const struct mmc_config *cfg, void *priv)
 {
 	struct blk_desc *bdesc;
@@ -157,6 +188,7 @@ void mmc_destroy(struct mmc *mmc)
 	/* only freeing memory for now */
 	free(mmc);
 }
+#endif
 
 static int mmc_select_hwpartp(struct blk_desc *desc, int hwpart)
 {
include/mmc.h +1 -0
index e815eb3..f39be3c 100644
@@ -513,6 +513,7 @@ void print_mmc_devices(char separator);
  * @return 0 if there is no MMC device, else the number of devices
  */
 int get_mmc_num(void);
+int mmc_switch_part(struct mmc *mmc, unsigned int part_num);
 int mmc_hwpart_config(struct mmc *mmc, const struct mmc_hwpart_conf *conf,
 		      enum mmc_hwpart_conf_mode mode);
 
#11 lore raw

PATCH 6/13 mmc: Add JZ47xx SD/MMC controller driver

In reply to Marek Vasut

From: Paul Burton <[email protected]>

Add driver for the JZ47xx MSC controller.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
Cc Jaehoon Chung <[email protected]>
---
 drivers/mmc/Kconfig  |   6 +
 drivers/mmc/Makefile |   1 +
 drivers/mmc/jz_mmc.c | 445 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 452 insertions(+)
 create mode 100644 drivers/mmc/jz_mmc.c
drivers/mmc/Kconfig +6 -0
index 5e84a41..da26743 100644
@@ -101,6 +101,12 @@ config MMC_UNIPHIER
 	help
 	  This selects support for the SD/MMC Host Controller on UniPhier SoCs.
 
+config JZ47XX_MMC
+	bool "Ingenic JZ47xx SD/MMC Host Controller support"
+	depends on ARCH_JZ47XX
+	help
+	  This selects support for the SD Card Controller on Ingenic JZ47xx SoCs.
+
 config SANDBOX_MMC
 	bool "Sandbox MMC support"
 	depends on MMC && SANDBOX
drivers/mmc/Makefile +1 -0
index d850758..5f7cca3 100644
@@ -57,6 +57,7 @@ obj-$(CONFIG_TEGRA_MMC) += tegra_mmc.o
 obj-$(CONFIG_MMC_UNIPHIER) += uniphier-sd.o
 obj-$(CONFIG_ZYNQ_SDHCI) += zynq_sdhci.o
 obj-$(CONFIG_ROCKCHIP_SDHCI) += rockchip_sdhci.o
+obj-$(CONFIG_JZ47XX_MMC) += jz_mmc.o
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
drivers/mmc/jz_mmc.c new file +445 -0

445 lines not on this page · raw message

Signature · 1 line
2.10.2
#12 lore raw

PATCH 6/13 mmc: Add JZ47xx SD/MMC controller driver

Dear Marek,

Quoted 3 lines · Marek Vasut

From: Paul Burton <[email protected]>

Add driver for the JZ47xx MSC controller.

I added more comment..Could you check my comments?

Quoted 108 lines
Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
Cc Jaehoon Chung <[email protected]>
---
 drivers/mmc/Kconfig  |   6 +
 drivers/mmc/Makefile |   1 +
 drivers/mmc/jz_mmc.c | 445 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 452 insertions(+)
 create mode 100644 drivers/mmc/jz_mmc.c
drivers/mmc/Kconfig +6 -0
index 5e84a41..da26743 100644
@@ -101,6 +101,12 @@ config MMC_UNIPHIER
 	help
 	  This selects support for the SD/MMC Host Controller on UniPhier SoCs.
 
+config JZ47XX_MMC
+	bool "Ingenic JZ47xx SD/MMC Host Controller support"
+	depends on ARCH_JZ47XX
+	help
+	  This selects support for the SD Card Controller on Ingenic JZ47xx SoCs.
+
 config SANDBOX_MMC
 	bool "Sandbox MMC support"
 	depends on MMC && SANDBOX
drivers/mmc/Makefile +1 -0
index d850758..5f7cca3 100644
@@ -57,6 +57,7 @@ obj-$(CONFIG_TEGRA_MMC) += tegra_mmc.o
 obj-$(CONFIG_MMC_UNIPHIER) += uniphier-sd.o
 obj-$(CONFIG_ZYNQ_SDHCI) += zynq_sdhci.o
 obj-$(CONFIG_ROCKCHIP_SDHCI) += rockchip_sdhci.o
+obj-$(CONFIG_JZ47XX_MMC) += jz_mmc.o
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
drivers/mmc/jz_mmc.c new file +61 -0
new file mode 100644
index 0000000..95b3367
@@ -0,0 +1,445 @@
+/*
+ * Ingenic JZ MMC driver
+ *
+ * Copyright (c) 2013 Imagination Technologies
+ * Author: Paul Burton <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <malloc.h>
+#include <mmc.h>
+#include <errno.h>
+#include <asm/io.h>
+#include <asm/unaligned.h>
+#include <mach/jz4780.h>
+#include <wait_bit.h>
+
+/* Registers */
+#define MSC_STRPCL			0x000
+#define MSC_STAT			0x004
+#define MSC_CLKRT			0x008
+#define MSC_CMDAT			0x00c
+#define MSC_RESTO			0x010
+#define MSC_RDTO			0x014
+#define MSC_BLKLEN			0x018
+#define MSC_NOB				0x01c
+#define MSC_SNOB			0x020
+#define MSC_IMASK			0x024
+#define MSC_IREG			0x028
+#define MSC_CMD				0x02c
+#define MSC_ARG				0x030
+#define MSC_RES				0x034
+#define MSC_RXFIFO			0x038
+#define MSC_TXFIFO			0x03c
+#define MSC_LPM				0x040
+#define MSC_DMAC			0x044
+#define MSC_DMANDA			0x048
+#define MSC_DMADA			0x04c
+#define MSC_DMALEN			0x050
+#define MSC_DMACMD			0x054
+#define MSC_CTRL2			0x058
+#define MSC_RTCNT			0x05c
+#define MSC_DBG				0x0fc
+
+/* MSC Clock and Control Register (MSC_STRPCL) */
+#define MSC_STRPCL_EXIT_MULTIPLE	BIT(7)
+#define MSC_STRPCL_EXIT_TRANSFER	BIT(6)
+#define MSC_STRPCL_START_READWAIT	BIT(5)
+#define MSC_STRPCL_STOP_READWAIT	BIT(4)
+#define MSC_STRPCL_RESET		BIT(3)
+#define MSC_STRPCL_START_OP		BIT(2)
+#define MSC_STRPCL_CLOCK_CONTROL_STOP	BIT(0)
+#define MSC_STRPCL_CLOCK_CONTROL_START	BIT(1)
+
+/* MSC Status Register (MSC_STAT) */
+#define MSC_STAT_AUTO_CMD_DONE		BIT(31)
+#define MSC_STAT_IS_RESETTING		BIT(15)
+#define MSC_STAT_SDIO_INT_ACTIVE	BIT(14)
+#define MSC_STAT_PRG_DONE		BIT(13)
+#define MSC_STAT_DATA_TRAN_DONE		BIT(12)

drivers/mmc/jz_mmc.c line 71

Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+#define MSC_STAT_END_CMD_RES		BIT(11)
+#define MSC_STAT_DATA_FIFO_AFULL	BIT(10)
+#define MSC_STAT_IS_READWAIT		BIT(9)
+#define MSC_STAT_CLK_EN			BIT(8)
+#define MSC_STAT_DATA_FIFO_FULL		BIT(7)
+#define MSC_STAT_DATA_FIFO_EMPTY	BIT(6)
+#define MSC_STAT_CRC_RES_ERR		BIT(5)
+#define MSC_STAT_CRC_READ_ERROR		BIT(4)
+#define MSC_STAT_CRC_WRITE_ERROR	BIT(2)
+#define MSC_STAT_CRC_WRITE_ERROR_NOSTS	BIT(4)

Does it use the same bit with MSC_STAT_CRC_READ_ERROR?

Quoted 98 lines
drivers/mmc/jz_mmc.c new file +98 -0
+#define MSC_STAT_TIME_OUT_RES		BIT(1)
+#define MSC_STAT_TIME_OUT_READ		BIT(0)
+
+/* MSC Bus Clock Control Register (MSC_CLKRT) */
+#define MSC_CLKRT_CLK_RATE_MASK		0x7
+
+/* MSC Command Sequence Control Register (MSC_CMDAT) */
+#define MSC_CMDAT_IO_ABORT		BIT(11)
+#define MSC_CMDAT_BUS_WIDTH_1BIT	(0x0 << 9)
+#define MSC_CMDAT_BUS_WIDTH_4BIT	(0x2 << 9)
+#define MSC_CMDAT_DMA_EN		BIT(8)
+#define MSC_CMDAT_INIT			BIT(7)
+#define MSC_CMDAT_BUSY			BIT(6)
+#define MSC_CMDAT_STREAM_BLOCK		BIT(5)
+#define MSC_CMDAT_WRITE			BIT(4)
+#define MSC_CMDAT_DATA_EN		BIT(3)
+#define MSC_CMDAT_RESPONSE_MASK		0x7
+#define MSC_CMDAT_RESPONSE_NONE		0x0 /* No response */
+#define MSC_CMDAT_RESPONSE_R1		0x1 /* Format R1 and R1b */
+#define MSC_CMDAT_RESPONSE_R2		0x2 /* Format R2 */
+#define MSC_CMDAT_RESPONSE_R3		0x3 /* Format R3 */
+#define MSC_CMDAT_RESPONSE_R4		0x4 /* Format R4 */
+#define MSC_CMDAT_RESPONSE_R5		0x5 /* Format R5 */
+#define MSC_CMDAT_RESPONSE_R6		0x6 /* Format R6 */
+
+/* MSC Interrupts Mask Register (MSC_IMASK) */
+#define MSC_IMASK_TIME_OUT_RES		BIT(9)
+#define MSC_IMASK_TIME_OUT_READ		BIT(8)
+#define MSC_IMASK_SDIO			BIT(7)
+#define MSC_IMASK_TXFIFO_WR_REQ		BIT(6)
+#define MSC_IMASK_RXFIFO_RD_REQ		BIT(5)
+#define MSC_IMASK_END_CMD_RES		BIT(2)
+#define MSC_IMASK_PRG_DONE		BIT(1)
+#define MSC_IMASK_DATA_TRAN_DONE	BIT(0)
+
+
+/* MSC Interrupts Status Register (MSC_IREG) */
+#define MSC_IREG_TIME_OUT_RES		BIT(9)
+#define MSC_IREG_TIME_OUT_READ		BIT(8)
+#define MSC_IREG_SDIO			BIT(7)
+#define MSC_IREG_TXFIFO_WR_REQ		BIT(6)
+#define MSC_IREG_RXFIFO_RD_REQ		BIT(5)
+#define MSC_IREG_END_CMD_RES		BIT(2)
+#define MSC_IREG_PRG_DONE		BIT(1)
+#define MSC_IREG_DATA_TRAN_DONE		BIT(0)
+
+struct jz_mmc_priv {
+	struct mmc_config	cfg;
+	void __iomem		*regs;
+	u32			flags;
+/* priv flags */
+#define JZ_MMC_BUS_WIDTH_MASK	0x3
+#define JZ_MMC_BUS_WIDTH_1	0x0
+#define JZ_MMC_BUS_WIDTH_4	0x2
+#define JZ_MMC_BUS_WIDTH_8	0x3
+#define JZ_MMC_SENT_INIT	BIT(2)
+};
+
+static int jz_mmc_clock_rate(void)
+{
+	return 24000000;
+}
+
+static int jz_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
+						struct mmc_data *data)
+{
+	struct jz_mmc_priv *priv = mmc->priv;
+	u32 stat, mask, cmdat = 0;
+
+	/* stop the clock */
+	writel(MSC_STRPCL_CLOCK_CONTROL_STOP, priv->regs + MSC_STRPCL);
+
+	wait_for_bit("jzmmc", priv->regs + MSC_STAT,
+		     MSC_STAT_CLK_EN, 0, 10, 0);
+
+	writel(0, priv->regs + MSC_DMAC);
+
+	/* setup command */
+	writel(cmd->cmdidx, priv->regs + MSC_CMD);
+	writel(cmd->cmdarg, priv->regs + MSC_ARG);
+
+	if (data) {
+		/* setup data */
+		cmdat |= MSC_CMDAT_DATA_EN;
+		if (data->flags & MMC_DATA_WRITE)
+			cmdat |= MSC_CMDAT_WRITE;
+
+		writel(data->blocks, priv->regs + MSC_NOB);
+		writel(data->blocksize, priv->regs + MSC_BLKLEN);
+	} else {
+		writel(0, priv->regs + MSC_NOB);
+		writel(0, priv->regs + MSC_BLKLEN);
+	}
+
+	/* setup response */
+	switch (cmd->resp_type) {
+	case MMC_RSP_NONE:
+		break;

drivers/mmc/jz_mmc.c line 179

Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+	case MMC_RSP_R1:
+	case MMC_RSP_R1b:
+		cmdat |= MSC_CMDAT_RESPONSE_R1;
+		break;
+	case MMC_RSP_R2:
+		cmdat |= MSC_CMDAT_RESPONSE_R2;
+		break;
+	case MMC_RSP_R3:
+		cmdat |= MSC_CMDAT_RESPONSE_R3;
+		break;

Can be put MMC_RSP_NONE at here?

drivers/mmc/jz_mmc.c line 190

Quoted 11 lines
drivers/mmc/jz_mmc.c new file +11 -0
+	default:
+		break;
+	}
+
+	if (cmd->resp_type & MMC_RSP_BUSY)
+		cmdat |= MSC_CMDAT_BUSY;
+
+	/* set init for the first command only */
+	if (!(priv->flags & JZ_MMC_SENT_INIT)) {
+		cmdat |= MSC_CMDAT_INIT;
+		priv->flags |= JZ_MMC_SENT_INIT;

Is it right?

drivers/mmc/jz_mmc.c line 193

Quoted 3 lines
drivers/mmc/jz_mmc.c new file +3 -0
+	}
+
+	cmdat |= (priv->flags & JZ_MMC_BUS_WIDTH_MASK) << 9;

After priv->flags is set to JZ_MMC_SENT_INIT (BIT(2)), immediately priv->flags & JZ_MMC_BUS_WIDTH_MASK (0x3) It's meaningless, doesn't?

drivers/mmc/jz_mmc.c line 199

Quoted 6 lines
drivers/mmc/jz_mmc.c new file +6 -0
+
+	/* write the data setup */
+	writel(cmdat, priv->regs + MSC_CMDAT);
+
+	/* unmask interrupts */
+	mask = 0xffffffff & ~(MSC_IMASK_END_CMD_RES | MSC_IMASK_TIME_OUT_RES);

No..it's not readable..mask can be 0.
It seems that first set to all mask without CMD_RES and OUT_RES. And at below sequence, clearing the bit after checking flags.

Why don't use the setting step, not clearing step?

drivers/mmc/jz_mmc.c line 203

Quoted 4 lines
drivers/mmc/jz_mmc.c new file +4 -0
+	if (data) {
+		mask &= ~MSC_IMASK_DATA_TRAN_DONE;
+		if (data->flags & MMC_DATA_WRITE) {
+			mask &= ~MSC_IMASK_TXFIFO_WR_REQ;

Then it can be "mask |= MSC_IMASK_TXFIFO_WR_REQ;"

drivers/mmc/jz_mmc.c line 206

Quoted 3 lines
drivers/mmc/jz_mmc.c new file +3 -0
+		} else {
+			mask &= ~(MSC_IMASK_RXFIFO_RD_REQ |
+				  MSC_IMASK_TIME_OUT_READ);

Ditto.

Quoted 18 lines
drivers/mmc/jz_mmc.c new file +18 -0
+		}
+	}
+	writel(mask, priv->regs + MSC_IMASK);
+
+	/* clear interrupts */
+	writel(0xffffffff, priv->regs + MSC_IREG);
+
+	/* start the command (& the clock) */
+	writel(MSC_STRPCL_START_OP | MSC_STRPCL_CLOCK_CONTROL_START,
+	       priv->regs + MSC_STRPCL);
+
+	/* wait for completion */
+	wait_for_bit("jzmmc", priv->regs + MSC_IREG,
+		     MSC_IREG_END_CMD_RES | MSC_IREG_TIME_OUT_RES, 1, 1, 0);
+	stat = readl(priv->regs + MSC_IREG);
+	stat &= MSC_IREG_END_CMD_RES | MSC_IREG_TIME_OUT_RES;
+	writel(stat, priv->regs + MSC_IREG);
+	if (stat & MSC_IREG_TIME_OUT_RES)

drivers/mmc/jz_mmc.c line 234

Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+		return -ETIMEDOUT;
+
+	if (cmd->resp_type & MMC_RSP_PRESENT) {
+		/* read the response */
+		if (cmd->resp_type & MMC_RSP_136) {
+			u16 a, b, c, i;
+			a = readw(priv->regs + MSC_RES);
+			for (i = 0; i < 4; i++) {
+				b = readw(priv->regs + MSC_RES);
+				c = readw(priv->regs + MSC_RES);

a and b and c are same? Why read MSC_RES twice?
Is register value changed?

drivers/mmc/jz_mmc.c line 242

Quoted 8 lines
drivers/mmc/jz_mmc.c new file +8 -0
+				cmd->response[i] = (a << 24) | (b << 8) |
+						   (c >> 8);
+				a = c;
+			}
+		} else {
+			cmd->response[0] = readw(priv->regs + MSC_RES) << 24;
+			cmd->response[0] |= readw(priv->regs + MSC_RES) << 8;
+			cmd->response[0] |= readw(priv->regs + MSC_RES) & 0xff;

Hmm..I didn't understand this..MSC_RES is 16bit register? It seems strange..

Quoted 34 lines
drivers/mmc/jz_mmc.c new file +34 -0
+		}
+	}
+
+	if (data && (data->flags & MMC_DATA_WRITE)) {
+		/* write the data */
+		int sz = DIV_ROUND_UP(data->blocks * data->blocksize, 4);
+		const void *buf = data->src;
+
+		while (sz--) {
+			u32 val = get_unaligned_le32(buf);
+			wait_for_bit("jzmmc", priv->regs + MSC_IREG,
+				     MSC_IREG_TXFIFO_WR_REQ, 1, 50, 0);
+			writel(val, priv->regs + MSC_TXFIFO);
+			buf += 4;
+		}
+	} else if (data && (data->flags & MMC_DATA_READ)) {
+		/* read the data */
+		int sz = data->blocks * data->blocksize;
+		void *buf = data->dest;
+
+		do {
+			stat = readl(priv->regs + MSC_STAT);
+
+			if (stat & MSC_STAT_TIME_OUT_READ)
+				return -ETIMEDOUT;
+			if (stat & MSC_STAT_CRC_READ_ERROR)
+				return -EILSEQ;
+			if (stat & MSC_STAT_DATA_FIFO_EMPTY) {
+				udelay(10);
+				continue;
+			}
+			do {
+				u32 val = readl(priv->regs + MSC_RXFIFO);
+

drivers/mmc/jz_mmc.c line 286

Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+				if (sz == 1)
+					*(u8 *)buf = (u8)val;
+				else if (sz == 2)
+					put_unaligned_le16(val, buf);
+				else if (sz >= 4)
+					put_unaligned_le32(val, buf);
+				buf += 4;
+				sz -= 4;
+				stat = readl(priv->regs + MSC_STAT);
+			} while (!(stat & MSC_STAT_DATA_FIFO_EMPTY));

Doesn't need to check whether size is zero or not? And error bit checking for stat?

Quoted 54 lines
drivers/mmc/jz_mmc.c new file +54 -0
+		} while (!(stat & MSC_STAT_DATA_TRAN_DONE));
+	}
+
+	return 0;
+}
+
+static void jz_mmc_set_ios(struct mmc *mmc)
+{
+	struct jz_mmc_priv *priv = mmc->priv;
+	u32 real_rate = jz_mmc_clock_rate();
+	u8 clk_div = 0;
+
+	/* calculate clock divide */
+	while ((real_rate > mmc->clock) && (clk_div < 7)) {
+		real_rate >>= 1;
+		clk_div++;
+	}
+	writel(clk_div & MSC_CLKRT_CLK_RATE_MASK, priv->regs + MSC_CLKRT);
+
+	/* set the bus width for the next command */
+	priv->flags &= ~JZ_MMC_BUS_WIDTH_MASK;
+	if (mmc->bus_width == 8)
+		priv->flags |= JZ_MMC_BUS_WIDTH_8;
+	else if (mmc->bus_width == 4)
+		priv->flags |= JZ_MMC_BUS_WIDTH_4;
+	else
+		priv->flags |= JZ_MMC_BUS_WIDTH_1;
+}
+
+static int jz_mmc_core_init(struct mmc *mmc)
+{
+	struct jz_mmc_priv *priv = mmc->priv;
+
+	/* Reset */
+	writel(MSC_STRPCL_RESET, priv->regs + MSC_STRPCL);
+
+	wait_for_bit("jzmmc", priv->regs + MSC_STAT,
+		     MSC_STAT_IS_RESETTING, 0, 10, 0);
+
+	/* Maximum timeouts */
+	writel(0xffff, priv->regs + MSC_RESTO);
+	writel(0xffffffff, priv->regs + MSC_RDTO);
+
+	/* Enable low power mode */
+	writel(0x1, priv->regs + MSC_LPM);
+
+	return 0;
+}
+
+static const struct mmc_ops jz_msc_ops = {
+	.send_cmd	= jz_mmc_send_cmd,
+	.set_ios	= jz_mmc_set_ios,
+	.init		= jz_mmc_core_init,
+};

drivers/mmc/jz_mmc.c line 350

Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+
+#ifdef CONFIG_MMC_TINY
+static struct jz_mmc_priv jz_mmc_priv_static = {
+	.cfg = {
+		.name = "MSC",
+		.ops = &jz_msc_ops,
+
+		.voltages = MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_29_30 |
+				MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
+				MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36,

Really need to set all VDD?

Quoted 31 lines
drivers/mmc/jz_mmc.c new file +31 -0
+		.host_caps = MMC_MODE_4BIT | MMC_MODE_HS_52MHz | MMC_MODE_HS,
+
+		.f_min = 375000,
+		.f_max = 48000000,
+		.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT,
+	},
+};
+
+int jz_mmc_init(void __iomem *base)
+{
+	struct mmc *mmc;
+
+	jz_mmc_priv_static.regs = base;
+
+	mmc = mmc_create(&jz_mmc_priv_static.cfg, &jz_mmc_priv_static);
+
+	return mmc ? 0 : -ENODEV;
+}
+#endif
+
+#ifdef CONFIG_DM_MMC
+#include <dm.h>
+DECLARE_GLOBAL_DATA_PTR;
+
+static int jz_mmc_ofdata_to_platdata(struct udevice *dev)
+{
+	struct jz_mmc_priv *priv = dev_get_priv(dev);
+	const void *fdt = gd->fdt_blob;
+	int node = dev->of_offset;
+	struct mmc_config *cfg;
+	int val;

drivers/mmc/jz_mmc.c line 391

Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+
+	priv->regs = map_physmem(dev_get_addr(dev), 0x100, MAP_NOCACHE);
+	cfg = &priv->cfg;
+
+	cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS;
+	val = fdtdec_get_int(fdt, node, "bus-width", 1);
+	if (val < 0) {
+		printf("error: bus-width property missing\n");
+		return -ENOENT;
+	}

Maybe i think this condition doesn't need..
because if buswidth is wrong, it should be returned error at below switch statement.

Quoted 19 lines
drivers/mmc/jz_mmc.c new file +19 -0
+
+	switch (val) {
+	case 0x8:
+		cfg->host_caps |= MMC_MODE_8BIT;
+	case 0x4:
+		cfg->host_caps |= MMC_MODE_4BIT;
+	case 0x1:
+		break;
+	default:
+		printf("error: invalid bus-width property\n");
+		return -ENOENT;
+	}
+
+	cfg->f_min = 400000;
+	cfg->f_max = fdtdec_get_int(fdt, node, "max-frequency", 52000000);
+	cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
+	cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
+
+	return 0;

drivers/mmc/jz_mmc.c line 420

Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+}
+
+static int jz_mmc_probe(struct udevice *dev)
+{
+	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+	struct jz_mmc_priv *priv = dev_get_priv(dev);
+	struct mmc_config *cfg = &priv->cfg;
+	struct mmc *mmc;
+
+	cfg->name = "MSC";

I guess...MSC is "Mobile Storage Controller"? Is it new IP for designware? Just wondering.. :)

Best Regards,
Jaehoon Chung

Quoted 26 lines
drivers/mmc/jz_mmc.c new file +25 -0
+	cfg->ops = &jz_msc_ops;
+
+	mmc = mmc_create(cfg, priv);
+	if (!mmc)
+		return -ENODEV;
+
+	mmc->dev = dev;
+	upriv->mmc = mmc;
+
+	return 0;
+}
+static const struct udevice_id jz_mmc_ids[] = {
+	{ .compatible = "ingenic,jz4780-mmc" },
+	{ }
+};
+
+U_BOOT_DRIVER(jz_mmc_drv) = {
+	.name			= "jz_mmc",
+	.id			= UCLASS_MMC,
+	.of_match		= jz_mmc_ids,
+	.ofdata_to_platdata	= jz_mmc_ofdata_to_platdata,
+	.probe			= jz_mmc_probe,
+	.priv_auto_alloc_size	= sizeof(struct jz_mmc_priv),
+};
+#endif
#13 lore raw

PATCH 6/13 mmc: Add JZ47xx SD/MMC controller driver

In reply to Marek Vasut

Am 01.12.2016 um 02:06 schrieb Marek Vasut:

Quoted 5 lines
drivers/mmc/jz_mmc.c new file +0 -0
new file mode 100644
index 0000000..95b3367

[...]

Quoted 1 line

+static void jz_mmc_set_ios(struct mmc *mmc)

This needs to return int by now.

Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+{
+	struct jz_mmc_priv *priv = mmc->priv;
+	u32 real_rate = jz_mmc_clock_rate();
+	u8 clk_div = 0;
+
+	/* calculate clock divide */
+	while ((real_rate > mmc->clock) && (clk_div < 7)) {
+		real_rate >>= 1;
+		clk_div++;
+	}

drivers/mmc/jz_mmc.c line 313

Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+	writel(clk_div & MSC_CLKRT_CLK_RATE_MASK, priv->regs + MSC_CLKRT);
+
+	/* set the bus width for the next command */
+	priv->flags &= ~JZ_MMC_BUS_WIDTH_MASK;
+	if (mmc->bus_width == 8)
+		priv->flags |= JZ_MMC_BUS_WIDTH_8;
+	else if (mmc->bus_width == 4)
+		priv->flags |= JZ_MMC_BUS_WIDTH_4;
+	else
+		priv->flags |= JZ_MMC_BUS_WIDTH_1;

return 0;

Quoted 1 line

+}

[...]

Quoted 1 line

+#ifdef CONFIG_MMC_TINY

Shouldn't this rather use something like #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_MMC_TINY) so that we can drop the #define from ci20.h?

Quoted 19 lines
drivers/mmc/jz_mmc.c new file +19 -0
+static struct jz_mmc_priv jz_mmc_priv_static = {
+	.cfg = {
+		.name = "MSC",
+		.ops = &jz_msc_ops,
+
+		.voltages = MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_29_30 |
+				MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
+				MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36,
+		.host_caps = MMC_MODE_4BIT | MMC_MODE_HS_52MHz | MMC_MODE_HS,
+
+		.f_min = 375000,
+		.f_max = 48000000,
+		.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT,
+	},
+};
+
+int jz_mmc_init(void __iomem *base)
+{
+	struct mmc *mmc;

drivers/mmc/jz_mmc.c line 371

Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+
+	jz_mmc_priv_static.regs = base;
+
+	mmc = mmc_create(&jz_mmc_priv_static.cfg, &jz_mmc_priv_static);
+
+	return mmc ? 0 : -ENODEV;
+}
+#endif
+
+#ifdef CONFIG_DM_MMC

Similarly here !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM_MMC)?

Quoted 64 lines
drivers/mmc/jz_mmc.c new file +64 -0
+#include <dm.h>
+DECLARE_GLOBAL_DATA_PTR;
+
+static int jz_mmc_ofdata_to_platdata(struct udevice *dev)
+{
+	struct jz_mmc_priv *priv = dev_get_priv(dev);
+	const void *fdt = gd->fdt_blob;
+	int node = dev->of_offset;
+	struct mmc_config *cfg;
+	int val;
+
+	priv->regs = map_physmem(dev_get_addr(dev), 0x100, MAP_NOCACHE);
+	cfg = &priv->cfg;
+
+	cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS;
+	val = fdtdec_get_int(fdt, node, "bus-width", 1);
+	if (val < 0) {
+		printf("error: bus-width property missing\n");
+		return -ENOENT;
+	}
+
+	switch (val) {
+	case 0x8:
+		cfg->host_caps |= MMC_MODE_8BIT;
+	case 0x4:
+		cfg->host_caps |= MMC_MODE_4BIT;
+	case 0x1:
+		break;
+	default:
+		printf("error: invalid bus-width property\n");
+		return -ENOENT;
+	}
+
+	cfg->f_min = 400000;
+	cfg->f_max = fdtdec_get_int(fdt, node, "max-frequency", 52000000);
+	cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
+	cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
+
+	return 0;
+}
+
+static int jz_mmc_probe(struct udevice *dev)
+{
+	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+	struct jz_mmc_priv *priv = dev_get_priv(dev);
+	struct mmc_config *cfg = &priv->cfg;
+	struct mmc *mmc;
+
+	cfg->name = "MSC";
+	cfg->ops = &jz_msc_ops;
+
+	mmc = mmc_create(cfg, priv);
+	if (!mmc)
+		return -ENODEV;
+
+	mmc->dev = dev;
+	upriv->mmc = mmc;
+
+	return 0;
+}
+static const struct udevice_id jz_mmc_ids[] = {
+	{ .compatible = "ingenic,jz4780-mmc" },
+	{ }
+};

drivers/mmc/jz_mmc.c line 445

Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+
+U_BOOT_DRIVER(jz_mmc_drv) = {
+	.name			= "jz_mmc",
+	.id			= UCLASS_MMC,
+	.of_match		= jz_mmc_ids,
+	.ofdata_to_platdata	= jz_mmc_ofdata_to_platdata,
+	.probe			= jz_mmc_probe,
+	.priv_auto_alloc_size	= sizeof(struct jz_mmc_priv),
+};
+#endif

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
#14 lore raw

PATCH 6/13 mmc: Add JZ47xx SD/MMC controller driver

Quoted 10 lines · Andreas F?rber

Am 01.12.2016 um 02:06 schrieb Marek Vasut:

Quoted 5 lines
drivers/mmc/jz_mmc.c new file +0 -0
new file mode 100644
index 0000000..95b3367

[...]

Quoted 1 line

+static void jz_mmc_set_ios(struct mmc *mmc)

This needs to return int by now.

Feel free to fix this up and resubmit :)

Quoted 140 lines
Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+{
+	struct jz_mmc_priv *priv = mmc->priv;
+	u32 real_rate = jz_mmc_clock_rate();
+	u8 clk_div = 0;
+
+	/* calculate clock divide */
+	while ((real_rate > mmc->clock) && (clk_div < 7)) {
+		real_rate >>= 1;
+		clk_div++;
+	}

drivers/mmc/jz_mmc.c line 313

Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+	writel(clk_div & MSC_CLKRT_CLK_RATE_MASK, priv->regs + MSC_CLKRT);
+
+	/* set the bus width for the next command */
+	priv->flags &= ~JZ_MMC_BUS_WIDTH_MASK;
+	if (mmc->bus_width == 8)
+		priv->flags |= JZ_MMC_BUS_WIDTH_8;
+	else if (mmc->bus_width == 4)
+		priv->flags |= JZ_MMC_BUS_WIDTH_4;
+	else
+		priv->flags |= JZ_MMC_BUS_WIDTH_1;

return 0;

Quoted 1 line

+}

[...]

Quoted 1 line

+#ifdef CONFIG_MMC_TINY

Shouldn't this rather use something like #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_MMC_TINY) so that we can drop the #define from ci20.h?

Quoted 19 lines
drivers/mmc/jz_mmc.c new file +19 -0
+static struct jz_mmc_priv jz_mmc_priv_static = {
+	.cfg = {
+		.name = "MSC",
+		.ops = &jz_msc_ops,
+
+		.voltages = MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_29_30 |
+				MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
+				MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36,
+		.host_caps = MMC_MODE_4BIT | MMC_MODE_HS_52MHz | MMC_MODE_HS,
+
+		.f_min = 375000,
+		.f_max = 48000000,
+		.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT,
+	},
+};
+
+int jz_mmc_init(void __iomem *base)
+{
+	struct mmc *mmc;

drivers/mmc/jz_mmc.c line 371

Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+
+	jz_mmc_priv_static.regs = base;
+
+	mmc = mmc_create(&jz_mmc_priv_static.cfg, &jz_mmc_priv_static);
+
+	return mmc ? 0 : -ENODEV;
+}
+#endif
+
+#ifdef CONFIG_DM_MMC

Similarly here !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM_MMC)?

Quoted 64 lines
drivers/mmc/jz_mmc.c new file +64 -0
+#include <dm.h>
+DECLARE_GLOBAL_DATA_PTR;
+
+static int jz_mmc_ofdata_to_platdata(struct udevice *dev)
+{
+	struct jz_mmc_priv *priv = dev_get_priv(dev);
+	const void *fdt = gd->fdt_blob;
+	int node = dev->of_offset;
+	struct mmc_config *cfg;
+	int val;
+
+	priv->regs = map_physmem(dev_get_addr(dev), 0x100, MAP_NOCACHE);
+	cfg = &priv->cfg;
+
+	cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS;
+	val = fdtdec_get_int(fdt, node, "bus-width", 1);
+	if (val < 0) {
+		printf("error: bus-width property missing\n");
+		return -ENOENT;
+	}
+
+	switch (val) {
+	case 0x8:
+		cfg->host_caps |= MMC_MODE_8BIT;
+	case 0x4:
+		cfg->host_caps |= MMC_MODE_4BIT;
+	case 0x1:
+		break;
+	default:
+		printf("error: invalid bus-width property\n");
+		return -ENOENT;
+	}
+
+	cfg->f_min = 400000;
+	cfg->f_max = fdtdec_get_int(fdt, node, "max-frequency", 52000000);
+	cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
+	cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
+
+	return 0;
+}
+
+static int jz_mmc_probe(struct udevice *dev)
+{
+	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+	struct jz_mmc_priv *priv = dev_get_priv(dev);
+	struct mmc_config *cfg = &priv->cfg;
+	struct mmc *mmc;
+
+	cfg->name = "MSC";
+	cfg->ops = &jz_msc_ops;
+
+	mmc = mmc_create(cfg, priv);
+	if (!mmc)
+		return -ENODEV;
+
+	mmc->dev = dev;
+	upriv->mmc = mmc;
+
+	return 0;
+}
+static const struct udevice_id jz_mmc_ids[] = {
+	{ .compatible = "ingenic,jz4780-mmc" },
+	{ }
+};

drivers/mmc/jz_mmc.c line 445

Quoted 10 lines
drivers/mmc/jz_mmc.c new file +10 -0
+
+U_BOOT_DRIVER(jz_mmc_drv) = {
+	.name			= "jz_mmc",
+	.id			= UCLASS_MMC,
+	.of_match		= jz_mmc_ids,
+	.ofdata_to_platdata	= jz_mmc_ofdata_to_platdata,
+	.probe			= jz_mmc_probe,
+	.priv_auto_alloc_size	= sizeof(struct jz_mmc_priv),
+};
+#endif

Regards,
Andreas

Signature · 2 lines
Best regards,
Marek Vasut
#15 lore raw

PATCH 6/13 mmc: Add JZ47xx SD/MMC controller driver

Am 12.02.2017 um 15:29 schrieb Marek Vasut:

Quoted 8 lines · Andreas F?rber
Quoted 7 lines

Am 01.12.2016 um 02:06 schrieb Marek Vasut:

Quoted 5 lines
drivers/mmc/jz_mmc.c new file +0 -0
new file mode 100644
index 0000000..95b3367

[...]

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

+static void jz_mmc_set_ios(struct mmc *mmc)

This needs to return int by now.

Feel free to fix this up and resubmit :)

Resubmitting with this trivial change wouldn't resolve Jaehoon's unanswered code questions from Dec 1 though. ;)

As mentioned elsewhere, my trivial fixup is available for anyone who wants to test or squash&resubmit:

https://github.com/afaerber/u-boot/commits/ci20

I don't know the Ingenic registers myself, sorry, and am already failing to resubmit my own unfinished RK3368 series...

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
#16 lore raw

PATCH 7/13 SPL: mmc: Make spl_mmc_load_image available

In reply to Marek Vasut

Make the spl_mmc_load_image() available globally, so it can be invoked directly by SPL on extremely space-constrained systems.

Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Jaehoon Chung <[email protected]>
---
 common/spl/spl_mmc.c | 4 ++--
 include/spl.h        | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)
common/spl/spl_mmc.c +2 -2
index 7dfcd0b..58b061f 100644
@@ -272,8 +272,8 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc)
 }
 #endif
 
-static int spl_mmc_load_image(struct spl_image_info *spl_image,
-			      struct spl_boot_device *bootdev)
+int spl_mmc_load_image(struct spl_image_info *spl_image,
+		       struct spl_boot_device *bootdev)
 {
 	struct mmc *mmc = NULL;
 	u32 boot_mode;
include/spl.h +3 -0
index e080a82..c727eb7 100644
@@ -234,4 +234,7 @@ bool spl_was_boot_source(void);
  */
 int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr);
 
+int spl_mmc_load_image(struct spl_image_info *spl_image,
+		       struct spl_boot_device *bootdev);
+
 #endif
Signature · 1 line
2.10.2
#17 lore raw

PATCH 7/13 SPL: mmc: Make spl_mmc_load_image available

Quoted 7 lines · Marek Vasut

Make the spl_mmc_load_image() available globally, so it can be invoked directly by SPL on extremely space-constrained systems.

Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Cc Jaehoon Chung <[email protected]>

Applied on u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung

Quoted 33 lines
---
 common/spl/spl_mmc.c | 4 ++--
 include/spl.h        | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)
common/spl/spl_mmc.c +2 -2
index 7dfcd0b..58b061f 100644
@@ -272,8 +272,8 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc)
 }
 #endif
 
-static int spl_mmc_load_image(struct spl_image_info *spl_image,
-			      struct spl_boot_device *bootdev)
+int spl_mmc_load_image(struct spl_image_info *spl_image,
+		       struct spl_boot_device *bootdev)
 {
 	struct mmc *mmc = NULL;
 	u32 boot_mode;
include/spl.h +3 -0
index e080a82..c727eb7 100644
@@ -234,4 +234,7 @@ bool spl_was_boot_source(void);
  */
 int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr);
 
+int spl_mmc_load_image(struct spl_image_info *spl_image,
+		       struct spl_boot_device *bootdev);
+
 #endif
#18 lore raw

PATCH 8/13 gpio: Add JZ47xx GPIO driver

In reply to Marek Vasut

From: Paul Burton <[email protected]>

Add primitive GPIO controller driver for the JZ47xx SoC.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 drivers/gpio/Kconfig       |  8 +++++
 drivers/gpio/Makefile      |  1 +
 drivers/gpio/gpio-jz47xx.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 88 insertions(+)
 create mode 100644 drivers/gpio/gpio-jz47xx.c
drivers/gpio/Kconfig +8 -0
index 8d9ab52..4515883 100644
@@ -221,4 +221,12 @@ config MPC85XX_GPIO
 
 	  The driver has been tested on MPC85XX, but it is likely that other
 	  PowerQUICC III devices will work as well.
+
+config JZ47XX_GPIO
+	bool "Ingenic JZ47xx GPIO driver"
+	depends on ARCH_JZ47XX
+	default y
+	help
+	  Supports GPIO access on Ingenic JZ47xx SoCs.
+
 endmenu
drivers/gpio/Makefile +1 -0
index 8939226..e562022 100644
@@ -58,3 +58,4 @@ obj-$(CONFIG_MVEBU_GPIO)	+= mvebu_gpio.o
 obj-$(CONFIG_MSM_GPIO)		+= msm_gpio.o
 obj-$(CONFIG_$(SPL_)PCF8575_GPIO)	+= pcf8575_gpio.o
 obj-$(CONFIG_PM8916_GPIO)	+= pm8916_gpio.o
+obj-$(CONFIG_JZ47XX_GPIO)	+= gpio-jz47xx.o
drivers/gpio/gpio-jz47xx.c new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
2.10.2
#19 lore raw

PATCH 9/13 misc: Add JZ47xx efuse driver

In reply to Marek Vasut

From: Paul Burton <[email protected]>

Add driver for the efuse block in the JZ47xx SOC.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 drivers/misc/Kconfig        |   6 +++
 drivers/misc/Makefile       |   1 +
 drivers/misc/jz4780_efuse.c | 100 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 107 insertions(+)
 create mode 100644 drivers/misc/jz4780_efuse.c
drivers/misc/Kconfig +6 -0
index 1aae4bc..ed0659b 100644
@@ -83,6 +83,12 @@ config FSL_SEC_MON
 	  Security Monitor can be transitioned on any security failures,
 	  like software violations or hardware security violations.
 
+config JZ4780_EFUSE
+	bool "Ingenic JZ4780 eFUSE support"
+	depends on ARCH_JZ47XX
+	help
+	  This selects support for the eFUSE on Ingenic JZ4780 SoCs.
+
 config MXC_OCOTP
 	bool "Enable MXC OCOTP Driver"
 	help
drivers/misc/Makefile +1 -0
index 9fbb5a7..6904a76 100644
@@ -51,3 +51,4 @@ obj-$(CONFIG_PCA9551_LED) += pca9551_led.o
 obj-$(CONFIG_FSL_DEVICE_DISABLE) += fsl_devdis.o
 obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o
 obj-$(CONFIG_QFW) += qfw.o
+obj-$(CONFIG_JZ4780_EFUSE) += jz4780_efuse.o
drivers/misc/jz4780_efuse.c new file +100 -0

100 lines not on this page · raw message

Signature · 1 line
2.10.2
#20 lore raw

PATCH 10/13 mips: Add SPL header

In reply to Marek Vasut

From: Paul Burton <[email protected]>

Add header with SPL boot mode and type definitions.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 arch/mips/include/asm/spl.h | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 arch/mips/include/asm/spl.h
arch/mips/include/asm/spl.h new file +35 -0
new file mode 100644
index 0000000..01baab6
@@ -0,0 +1,35 @@
+/*
+ * (C) Copyright 2012
+ * Texas Instruments, <www.ti.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#ifndef	_ASM_SPL_H_
+#define	_ASM_SPL_H_
+
+enum {
+	BOOT_DEVICE_RAM,
+	BOOT_DEVICE_MMC1,
+	BOOT_DEVICE_MMC2,
+	BOOT_DEVICE_MMC2_2,
+	BOOT_DEVICE_NAND,
+	BOOT_DEVICE_ONENAND,
+	BOOT_DEVICE_NOR,
+	BOOT_DEVICE_UART,
+	BOOT_DEVICE_SPI,
+	BOOT_DEVICE_USB,
+	BOOT_DEVICE_SATA,
+	BOOT_DEVICE_I2C,
+	BOOT_DEVICE_BOARD,
+	BOOT_DEVICE_NONE
+};
+
+/* Linker symbols. */
+extern char __bss_start[];
+extern ulong __bss_end;
+
+#ifndef CONFIG_DM
+extern gd_t gdata;
+#endif
+
+#endif
Signature · 1 line
2.10.2
#21 lore raw

PATCH 11/13 mips: jz47xx: Add JZ4780 SoC support

In reply to Marek Vasut

From: Paul Burton <[email protected]>

Add initial support for the Ingenic JZ47xx MIPS SoC. The DTSI file comes from Linux 4.6 as of revision 78800558d104e003f9ae92e0107f1de39cf9de9f

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 arch/mips/Kconfig                                |   7 +
 arch/mips/Makefile                               |   1 +
 arch/mips/dts/jz4780.dtsi                        | 142 ++++++
 arch/mips/mach-jz47xx/Kconfig                    |  15 +
 arch/mips/mach-jz47xx/Makefile                   |   7 +
 arch/mips/mach-jz47xx/include/mach/jz4780.h      |  99 +++++
 arch/mips/mach-jz47xx/include/mach/jz4780_dram.h | 457 ++++++++++++++++++++
 arch/mips/mach-jz47xx/jz4780/Makefile            |   5 +
 arch/mips/mach-jz47xx/jz4780/jz4780.c            | 135 ++++++
 arch/mips/mach-jz47xx/jz4780/pll.c               | 527 +++++++++++++++++++++++
 arch/mips/mach-jz47xx/jz4780/sdram.c             | 271 ++++++++++++
 arch/mips/mach-jz47xx/jz4780/timer.c             | 238 ++++++++++
 arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds      |  52 +++
 arch/mips/mach-jz47xx/start.S                    |  99 +++++
 include/dt-bindings/clock/jz4780-cgu.h           |  88 ++++
 15 files changed, 2143 insertions(+)
 create mode 100644 arch/mips/dts/jz4780.dtsi
 create mode 100644 arch/mips/mach-jz47xx/Kconfig
 create mode 100644 arch/mips/mach-jz47xx/Makefile
 create mode 100644 arch/mips/mach-jz47xx/include/mach/jz4780.h
 create mode 100644 arch/mips/mach-jz47xx/include/mach/jz4780_dram.h
 create mode 100644 arch/mips/mach-jz47xx/jz4780/Makefile
 create mode 100644 arch/mips/mach-jz47xx/jz4780/jz4780.c
 create mode 100644 arch/mips/mach-jz47xx/jz4780/pll.c
 create mode 100644 arch/mips/mach-jz47xx/jz4780/sdram.c
 create mode 100644 arch/mips/mach-jz47xx/jz4780/timer.c
 create mode 100644 arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds
 create mode 100644 arch/mips/mach-jz47xx/start.S
 create mode 100644 include/dt-bindings/clock/jz4780-cgu.h
arch/mips/Kconfig +7 -0
index d97930e..40d876f 100644
@@ -75,6 +75,12 @@ config ARCH_ATH79
 	select OF_CONTROL
 	select DM
 
+config ARCH_JZ47XX
+	bool "Support Ingenic JZ47xx"
+	select SUPPORT_SPL
+	select OF_CONTROL
+	select DM
+
 config MACH_PIC32
 	bool "Support Microchip PIC32"
 	select OF_CONTROL
@@ -123,6 +129,7 @@ source "board/micronas/vct/Kconfig"
 source "board/pb1x00/Kconfig"
 source "board/qemu-mips/Kconfig"
 source "arch/mips/mach-ath79/Kconfig"
+source "arch/mips/mach-jz47xx/Kconfig"
 source "arch/mips/mach-pic32/Kconfig"
 
 if MIPS
arch/mips/Makefile +1 -0
index efe7e44..4f0f797 100644
@@ -15,6 +15,7 @@ libs-y += arch/mips/lib/
 
 machine-$(CONFIG_SOC_AU1X00) += au1x00
 machine-$(CONFIG_ARCH_ATH79) += ath79
+machine-$(CONFIG_ARCH_JZ47XX) += jz47xx
 machine-$(CONFIG_MACH_PIC32) += pic32
 
 machdirs := $(patsubst %,arch/mips/mach-%/,$(machine-y))
arch/mips/dts/jz4780.dtsi new file +142 -0

142 lines not on this page · raw message

arch/mips/mach-jz47xx/Kconfig new file +15 -0
new file mode 100644
index 0000000..cd6944c
@@ -0,0 +1,15 @@
+menu "Ingenic JZ47xx platforms"
+	depends on ARCH_JZ47XX
+
+config SYS_SOC
+	default "jz47xx"
+
+config SOC_JZ4780
+	bool
+	select SUPPORTS_LITTLE_ENDIAN
+	select SUPPORTS_CPU_MIPS32_R1
+	select SUPPORTS_CPU_MIPS32_R2
+	help
+	  Support for Ingenic JZ4780 family SoCs.
+
+endmenu
arch/mips/mach-jz47xx/Makefile new file +7 -0
new file mode 100644
index 0000000..5eee9ac
@@ -0,0 +1,7 @@
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+extra-$(CONFIG_SPL_BUILD)	:= start.o
+
+obj-$(CONFIG_SOC_JZ4780)	+= jz4780/
arch/mips/mach-jz47xx/include/mach/jz4780.h new file +99 -0

99 lines not on this page · raw message

arch/mips/mach-jz47xx/include/mach/jz4780_dram.h new file +457 -0

457 lines not on this page · raw message

arch/mips/mach-jz47xx/jz4780/Makefile new file +5 -0
new file mode 100644
index 0000000..683eea6
@@ -0,0 +1,5 @@
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y := jz4780.o pll.o sdram.o timer.o
arch/mips/mach-jz47xx/jz4780/jz4780.c new file +135 -0

135 lines not on this page · raw message

arch/mips/mach-jz47xx/jz4780/pll.c new file +527 -0

527 lines not on this page · raw message

arch/mips/mach-jz47xx/jz4780/sdram.c new file +271 -0

271 lines not on this page · raw message

arch/mips/mach-jz47xx/jz4780/timer.c new file +238 -0

238 lines not on this page · raw message

arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds new file +52 -0

52 lines not on this page · raw message

arch/mips/mach-jz47xx/start.S new file +99 -0

99 lines not on this page · raw message

include/dt-bindings/clock/jz4780-cgu.h new file +88 -0

88 lines not on this page · raw message

Signature · 1 line
2.10.2
#22 lore raw

PATCH 12/13 mips: jz47xx: Add minimal JZ MMC node

In reply to Marek Vasut

Add minimal JZ MMC node into the JZ4780 device tree. This piece is picked from the CI20 Linux repository.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 arch/mips/dts/jz4780.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/mips/dts/jz4780.dtsi +20 -0
index 8f01d36..b017055 100644
@@ -44,6 +44,26 @@
 		#clock-cells = <1>;
 	};
 
+	msc0: msc at 13450000 {
+		compatible = "ingenic,jz4780-mmc";
+		reg = <0x13450000 0x1000>;
+
+		status = "disabled";
+
+		clocks = <&cgu JZ4780_CLK_MSC0>;
+		clock-names = "mmc";
+	};
+
+	msc1: msc at 13460000 {
+		compatible = "ingenic,jz4780-mmc";
+		reg = <0x13460000 0x1000>;
+
+		clocks = <&cgu JZ4780_CLK_MSC1>;
+		clock-names = "mmc";
+
+		status = "disabled";
+	};
+
 	uart0: serial at 10030000 {
 		compatible = "ingenic,jz4780-uart";
 		reg = <0x10030000 0x100>;
Signature · 1 line
2.10.2
#23 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

In reply to Marek Vasut

From: Paul Burton <[email protected]>

Add support for the Creator CI20 platform based on the JZ4780 SoC. The DTS file comes from Linux 4.6 as of revision 78800558d104e003f9ae92e0107f1de39cf9de9f

So far, there are still a few details which will have to be fixed once they are fleshed out in Linux:
- pinmux: Thus far, this board just pokes the pinmux registers to set the pinmux. For MMC in SPL, this will have to stay. But for full u-boot a proper pinmux driver will have to be added once the pinmux semantics in DT are in mainline Linux.
- ethernet,efuse: DT bindings are missing from mainline Linux.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 arch/mips/dts/Makefile        |   1 +
 arch/mips/dts/ci20.dts        | 114 ++++++++++++++
 arch/mips/mach-jz47xx/Kconfig |  11 ++
 board/imgtec/ci20/Kconfig     |  35 +++++
 board/imgtec/ci20/Makefile    |   5 +
 board/imgtec/ci20/README      |  10 ++
 board/imgtec/ci20/ci20.c      | 354 ++++++++++++++++++++++++++++++++++++++++++
 configs/ci20_defconfig        |  28 ++++
 include/configs/ci20.h        | 105 +++++++++++++
 9 files changed, 663 insertions(+)
 create mode 100644 arch/mips/dts/ci20.dts
 create mode 100644 board/imgtec/ci20/Kconfig
 create mode 100644 board/imgtec/ci20/Makefile
 create mode 100644 board/imgtec/ci20/README
 create mode 100644 board/imgtec/ci20/ci20.c
 create mode 100644 configs/ci20_defconfig
 create mode 100644 include/configs/ci20.h
arch/mips/dts/Makefile +1 -0
index 30fcc2b..e3473d9 100644
@@ -9,6 +9,7 @@ dtb-$(CONFIG_TARGET_MALTA) += mti,malta.dtb
 dtb-$(CONFIG_TARGET_PIC32MZDASK) += pic32mzda_sk.dtb
 dtb-$(CONFIG_TARGET_XILFPGA) += nexys4ddr.dtb
 dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb
+dtb-$(CONFIG_TARGET_JZ4780_CI20) += ci20.dtb
 
 targets += $(dtb-y)
 
arch/mips/dts/ci20.dts new file +114 -0

114 lines not on this page · raw message

arch/mips/mach-jz47xx/Kconfig +11 -0
index cd6944c..dcaac01 100644
@@ -12,4 +12,15 @@ config SOC_JZ4780
 	help
 	  Support for Ingenic JZ4780 family SoCs.
 
+choice
+	prompt "Board select"
+
+config TARGET_JZ4780_CI20
+	bool "Creator CI20 Reference Board"
+	select SOC_JZ4780
+
+endchoice
+
+source "board/imgtec/ci20/Kconfig"
+
 endmenu
board/imgtec/ci20/Kconfig new file +35 -0
new file mode 100644
index 0000000..5613df8
@@ -0,0 +1,35 @@
+if TARGET_JZ4780_CI20
+
+config SYS_BOARD
+	default "ci20"
+
+config SYS_VENDOR
+	default "imgtec"
+
+config SYS_CONFIG_NAME
+	default "ci20"
+
+config SYS_TEXT_BASE
+	default 0x80000000
+
+config JTAG
+	bool
+	default y
+
+config SYS_AUDIO_SPEED
+	int
+	default 768000000
+
+config SYS_EXTAL
+	int
+	default 48000000
+
+config SYS_MEM_DIV
+	int
+	default 3
+
+config SYS_MEM_SPEED
+	int
+	default 1200000000
+
+endif
board/imgtec/ci20/Makefile new file +5 -0
new file mode 100644
index 0000000..8c00081
@@ -0,0 +1,5 @@
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y := ci20.o
board/imgtec/ci20/README new file +10 -0
new file mode 100644
index 0000000..c757d41
@@ -0,0 +1,10 @@
+CI20 U-Boot
+
+Installation to an SD card:
+  Repartition your card with an MBR such that the first partition starts at an
+  offset of no less than 270KB. Then install U-Boot SPL & the full U-Boot image
+  to the card like so:
+
+    dd if=spl/u-boot-spl.bin of=/dev/sdX obs=512 seek=1
+    dd if=u-boot.img of=/dev/sdX obs=1K seek=14
+    sync
board/imgtec/ci20/ci20.c new file +354 -0

354 lines not on this page · raw message

configs/ci20_defconfig new file +28 -0
new file mode 100644
index 0000000..65bb2a0
@@ -0,0 +1,28 @@
+CONFIG_MIPS=y
+CONFIG_ARCH_JZ47XX=y
+CONFIG_TARGET_JZ4780_CI20=y
+CONFIG_DEFAULT_DEVICE_TREE="ci20"
+CONFIG_SPL=y
+CONFIG_SPL_MMC_TINY=y
+CONFIG_FIT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_DISPLAY_BOARDINFO=y
+# CONFIG_CMD_IMLS is not set
+CONFIG_CMD_MMC=y
+CONFIG_DM_MMC=y
+# CONFIG_DM_MMC_OPS is not set
+# CONFIG_BLK is not set
+# CONFIG_SPL_DM_MMC is not set
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FAT=y
+CONFIG_JZ4780_EFUSE=y
+CONFIG_JZ47XX_GPIO=y
+CONFIG_JZ47XX_MMC=y
+CONFIG_USE_PRIVATE_LIBGCC=y
+CONFIG_SYS_NS16550=y
+CONFIG_DM_SERIAL=y
+CONFIG_SYS_DCACHE_SIZE=32768
+CONFIG_SYS_ICACHE_SIZE=32768
+CONFIG_SYS_DCACHE_LINE_SIZE=32
+CONFIG_SYS_ICACHE_LINE_SIZE=32
include/configs/ci20.h new file +105 -0

105 lines not on this page · raw message

Signature · 1 line
2.10.2
#24 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

Hi Marek,

Am 01.12.2016 um 02:06 schrieb Marek Vasut:

Quoted 28 lines

From: Paul Burton <[email protected]>

Add support for the Creator CI20 platform based on the JZ4780 SoC. The DTS file comes from Linux 4.6 as of revision 78800558d104e003f9ae92e0107f1de39cf9de9f

So far, there are still a few details which will have to be fixed once they are fleshed out in Linux:
- pinmux: Thus far, this board just pokes the pinmux registers to set the pinmux. For MMC in SPL, this will have to stay. But for full u-boot a proper pinmux driver will have to be added once the pinmux semantics in DT are in mainline Linux.
- ethernet,efuse: DT bindings are missing from mainline Linux.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 arch/mips/dts/Makefile        |   1 +
 arch/mips/dts/ci20.dts        | 114 ++++++++++++++
 arch/mips/mach-jz47xx/Kconfig |  11 ++
 board/imgtec/ci20/Kconfig     |  35 +++++
 board/imgtec/ci20/Makefile    |   5 +
 board/imgtec/ci20/README      |  10 ++
 board/imgtec/ci20/ci20.c      | 354 ++++++++++++++++++++++++++++++++++++++++++
 configs/ci20_defconfig        |  28 ++++
 include/configs/ci20.h        | 105 +++++++++++++
Quoted 8 lines
 9 files changed, 663 insertions(+)
 create mode 100644 arch/mips/dts/ci20.dts
 create mode 100644 board/imgtec/ci20/Kconfig
 create mode 100644 board/imgtec/ci20/Makefile
 create mode 100644 board/imgtec/ci20/README
 create mode 100644 board/imgtec/ci20/ci20.c
 create mode 100644 configs/ci20_defconfig
 create mode 100644 include/configs/ci20.h

I've looked into testing the remainder of this patchset, not seeing a newer version. You can find my branch here:

https://github.com/afaerber/u-boot/commits/ci20

In particular I fixed the MMC set_ios signature to silence a warning about the int vs. void return type, which I intend to clean up and submit.

The code compiled okay after some defconfig tweaks, save for a few unused-variable SPL-only warnings, but testing did not give any output. Investigating that, it seemed to me CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y was missing for CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR. Some other include options could be moved into defconfig, too.

CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y leads to this error:

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 288 bytes ../scripts/Makefile.spl:304: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1 /home/andreas/OBS/u-boot/Makefile:1342: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2
make[1]: Leaving directory '/home/andreas/OBS/u-boot/ci20' Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

I've reviewed all SPL Kconfig options and found three seemingly unneeded options defaulting to y, but I did not find a way to get this number down even a single byte with my GCC 6.3.1, and the recommended 4.8.1 was even worse (~748). I also tried combining the downstream 4.8.1-built SPL with the upstream U-Boot (from without CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR), but still no output.

Is this the reason this series is not respun?

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
#25 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

Quoted 1 line · Andreas F?rber

Hi Marek,

Hi!

Quoted 46 lines

Am 01.12.2016 um 02:06 schrieb Marek Vasut:

Quoted 28 lines

From: Paul Burton <[email protected]>

Add support for the Creator CI20 platform based on the JZ4780 SoC. The DTS file comes from Linux 4.6 as of revision 78800558d104e003f9ae92e0107f1de39cf9de9f

So far, there are still a few details which will have to be fixed once they are fleshed out in Linux:
- pinmux: Thus far, this board just pokes the pinmux registers to set the pinmux. For MMC in SPL, this will have to stay. But for full u-boot a proper pinmux driver will have to be added once the pinmux semantics in DT are in mainline Linux.
- ethernet,efuse: DT bindings are missing from mainline Linux.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 arch/mips/dts/Makefile        |   1 +
 arch/mips/dts/ci20.dts        | 114 ++++++++++++++
 arch/mips/mach-jz47xx/Kconfig |  11 ++
 board/imgtec/ci20/Kconfig     |  35 +++++
 board/imgtec/ci20/Makefile    |   5 +
 board/imgtec/ci20/README      |  10 ++
 board/imgtec/ci20/ci20.c      | 354 ++++++++++++++++++++++++++++++++++++++++++
 configs/ci20_defconfig        |  28 ++++
 include/configs/ci20.h        | 105 +++++++++++++
Quoted 8 lines
 9 files changed, 663 insertions(+)
 create mode 100644 arch/mips/dts/ci20.dts
 create mode 100644 board/imgtec/ci20/Kconfig
 create mode 100644 board/imgtec/ci20/Makefile
 create mode 100644 board/imgtec/ci20/README
 create mode 100644 board/imgtec/ci20/ci20.c
 create mode 100644 configs/ci20_defconfig
 create mode 100644 include/configs/ci20.h

I've looked into testing the remainder of this patchset, not seeing a newer version. You can find my branch here:

https://github.com/afaerber/u-boot/commits/ci20

In particular I fixed the MMC set_ios signature to silence a warning about the int vs. void return type, which I intend to clean up and submit.

Quoted 6 lines

The code compiled okay after some defconfig tweaks, save for a few unused-variable SPL-only warnings, but testing did not give any output. Investigating that, it seemed to me CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y was missing for CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR. Some other include options could be moved into defconfig, too.

Hm, so it broke again ? That's kinda sad ...

Quoted 15 lines

CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y leads to this error:

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 288 bytes ../scripts/Makefile.spl:304: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1 /home/andreas/OBS/u-boot/Makefile:1342: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2
make[1]: Leaving directory '/home/andreas/OBS/u-boot/ci20' Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

Quoted 4 lines

I've reviewed all SPL Kconfig options and found three seemingly unneeded options defaulting to y, but I did not find a way to get this number down even a single byte with my GCC 6.3.1, and the recommended 4.8.1 was even worse (~748).

The recommended one was gcc 6.x , again, when I submitted it, I had no problem. So it seems U-Boot again gained bloat, oh well ...

Quoted 5 lines

I also tried combining the downstream 4.8.1-built SPL with the upstream U-Boot (from without CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR), but still no output.

Is this the reason this series is not respun?

Eh ? No, the reason is I lack time :) The SPL will give you no output though, since it is stripped down to bare minimum.

Quoted 3 lines

Regards,
Andreas

Signature · 2 lines
Best regards,
Marek Vasut
#26 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

Am 12.02.2017 um 12:55 schrieb Marek Vasut:

Quoted 16 lines · Andreas F?rber
Quoted 15 lines

CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y leads to this error:

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 288 bytes ../scripts/Makefile.spl:304: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1 /home/andreas/OBS/u-boot/Makefile:1342: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2
make[1]: Leaving directory '/home/andreas/OBS/u-boot/ci20' Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

Quoted 6 lines
Quoted 4 lines

I've reviewed all SPL Kconfig options and found three seemingly unneeded options defaulting to y, but I did not find a way to get this number down even a single byte with my GCC 6.3.1, and the recommended 4.8.1 was even worse (~748).

The recommended one was gcc 6.x , [...]

http://elinux.org/CI20_Dev_Zone#Toolchain

eLinux.org recommends a 2013.11 CodeSourcery toolchain with gcc 4.8.1:

"For compiling u-boot, please use this. u-boot first stage spl has a size limitation.
And this toolchain manages to generate a binary that is just within the limit."

Sadly it isn't.

I'm looking into a gcc7 package next, but that'll take a bit.

Cheers,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
#27 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

Quoted 22 lines · Andreas F?rber

Am 12.02.2017 um 12:55 schrieb Marek Vasut:

Quoted 21 lines · Andreas F?rber
Quoted 19 lines

CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y leads to this error:

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 288 bytes ../scripts/Makefile.spl:304: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1 /home/andreas/OBS/u-boot/Makefile:1342: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2
make[1]: Leaving directory '/home/andreas/OBS/u-boot/ci20' Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

I've reviewed all SPL Kconfig options and found three seemingly unneeded options defaulting to y, but I did not find a way to get this number down even a single byte with my GCC 6.3.1, and the recommended 4.8.1 was even worse (~748).

Quoted 5 lines
Quoted 1 line

The recommended one was gcc 6.x , [...]

http://elinux.org/CI20_Dev_Zone#Toolchain

eLinux.org recommends a 2013.11 CodeSourcery toolchain with gcc 4.8.1:

Well probably for some ancient vendoruboot ;-)

Quoted 8 lines

"For compiling u-boot, please use this. u-boot first stage spl has a size limitation.
And this toolchain manages to generate a binary that is just within the limit."

Sadly it isn't.

I'm looking into a gcc7 package next, but that'll take a bit.

I don't think that's gonna help with U-Boot's bloat. I had to trim down a lot of things already (ie. the MMC tinification), but it seems U-Boot is growing and growing.

Signature · 2 lines
Best regards,
Marek Vasut
#28 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

Am 12.02.2017 um 13:53 schrieb Marek Vasut:

Quoted 23 lines · Andreas F?rber
Quoted 22 lines

Am 12.02.2017 um 12:55 schrieb Marek Vasut:

Quoted 21 lines · Andreas F?rber
Quoted 19 lines

CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y leads to this error:

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 288 bytes ../scripts/Makefile.spl:304: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1 /home/andreas/OBS/u-boot/Makefile:1342: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2
make[1]: Leaving directory '/home/andreas/OBS/u-boot/ci20' Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

I've reviewed all SPL Kconfig options and found three seemingly unneeded options defaulting to y, but I did not find a way to get this number down even a single byte with my GCC 6.3.1, and the recommended 4.8.1 was even worse (~748).

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

The recommended one was gcc 6.x , [...]

http://elinux.org/CI20_Dev_Zone#Toolchain

eLinux.org recommends a 2013.11 CodeSourcery toolchain with gcc 4.8.1:

Well probably for some ancient vendoruboot ;-)

v2013.10 based. ;-)

Quoted 10 lines
Quoted 8 lines

"For compiling u-boot, please use this. u-boot first stage spl has a size limitation.
And this toolchain manages to generate a binary that is just within the limit."

Sadly it isn't.

I'm looking into a gcc7 package next, but that'll take a bit.

I don't think that's gonna help with U-Boot's bloat. [...]

Yeah, slightly down with GCC 7.0.1, but not much:

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 264 bytes ../scripts/Makefile.spl:304: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1 /home/andreas/OBS/u-boot/Makefile:1342: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2
make[1]: Leaving directory '/home/andreas/OBS/u-boot/ci20' Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

Cheers,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
#29 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

Quoted 26 lines · Andreas F?rber

Am 12.02.2017 um 13:53 schrieb Marek Vasut:

Quoted 25 lines · Andreas F?rber
Quoted 24 lines

Am 12.02.2017 um 12:55 schrieb Marek Vasut:

Quoted 22 lines · Andreas F?rber
Quoted 15 lines

CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y leads to this error:

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 288 bytes ../scripts/Makefile.spl:304: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1 /home/andreas/OBS/u-boot/Makefile:1342: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2
make[1]: Leaving directory '/home/andreas/OBS/u-boot/ci20' Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

Quoted 4 lines

I've reviewed all SPL Kconfig options and found three seemingly unneeded options defaulting to y, but I did not find a way to get this number down even a single byte with my GCC 6.3.1, and the recommended 4.8.1 was even worse (~748).

The recommended one was gcc 6.x , [...]

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

http://elinux.org/CI20_Dev_Zone#Toolchain

eLinux.org recommends a 2013.11 CodeSourcery toolchain with gcc 4.8.1:

Well probably for some ancient vendoruboot ;-)

v2013.10 based. ;-)

Well, that's still reasonably recent for a vendoruboot on mips ...

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

"For compiling u-boot, please use this. u-boot first stage spl has a size limitation.
And this toolchain manages to generate a binary that is just within the limit."

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Sadly it isn't.

I'm looking into a gcc7 package next, but that'll take a bit.

I don't think that's gonna help with U-Boot's bloat. [...]

Yeah, slightly down with GCC 7.0.1, but not much:

Right, it's the new bloat ...

Quoted 16 lines

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 264 bytes ../scripts/Makefile.spl:304: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1 /home/andreas/OBS/u-boot/Makefile:1342: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2
make[1]: Leaving directory '/home/andreas/OBS/u-boot/ci20' Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

Cheers,
Andreas

Signature · 2 lines
Best regards,
Marek Vasut
#30 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

Am 12.02.2017 um 15:03 schrieb Marek Vasut:

Quoted 24 lines · Andreas Färber
Quoted 23 lines

Am 12.02.2017 um 13:53 schrieb Marek Vasut:

Quoted 22 lines · Andreas Färber
Quoted 21 lines

Am 12.02.2017 um 12:55 schrieb Marek Vasut:

Quoted 20 lines · Andreas Färber
Quoted 19 lines

CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y leads to this error:

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 288 bytes ../scripts/Makefile.spl:304: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1 /home/andreas/OBS/u-boot/Makefile:1342: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2
make[1]: Leaving directory '/home/andreas/OBS/u-boot/ci20' Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

I've reviewed all SPL Kconfig options and found three seemingly unneeded options defaulting to y, but I did not find a way to get this number down even a single byte with my GCC 6.3.1, and the recommended 4.8.1 was even worse (~748).

Quoted 20 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

I'm looking into a gcc7 package next, but that'll take a bit.

I don't think that's gonna help with U-Boot's bloat. [...]

Yeah, slightly down with GCC 7.0.1, but not much:

Right, it's the new bloat ...

Quoted 12 lines

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 264 bytes ../scripts/Makefile.spl:304: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1 /home/andreas/OBS/u-boot/Makefile:1342: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2
make[1]: Leaving directory '/home/andreas/OBS/u-boot/ci20' Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

Update: I've rebased the patchset to latest master (8cb3ce64f936f5dedbcfc1935c5caf31bb682474 / "Merge
git://git.denx.de/u-boot-dm") - BMIPS caused trivial conflicts, and DM API changes needed to be accounted for.

https://github.com/afaerber/u-boot/commits/ci20

By further disabling CONFIG_SPL_RAW_IMAGE_SUPPORT in the ci20 defconfig I am now at 344 bytes overflow (gcc 7.1.1):

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 344 bytes ../scripts/Makefile.spl:333: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1 /home/andreas/OBS/u-boot/Makefile:1382: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2

By disabling SPL GPIO support and hardcoding a board revision instead of detecting it via GPIOs, I can get it down to 80 bytes.

By aggressively adding #ifndef CONFIG_SPL_BUILD in ci20.c I'm down to 64 bytes, but not sure if some of that is actually needed for SPL...

Tom, do you see a chance of merging any of the drivers without the whole board building, so that we can reduce the rebasing work and get a common base for optimizing?

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
#31 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

Quoted 69 lines · Andreas F채rber

Am 12.02.2017 um 15:03 schrieb Marek Vasut:

Quoted 24 lines · Andreas F채rber
Quoted 23 lines

Am 12.02.2017 um 13:53 schrieb Marek Vasut:

Quoted 22 lines · Andreas F채rber
Quoted 21 lines

Am 12.02.2017 um 12:55 schrieb Marek Vasut:

Quoted 20 lines · Andreas F채rber
Quoted 19 lines

CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y leads to this error:

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 288 bytes ../scripts/Makefile.spl:304: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1 /home/andreas/OBS/u-boot/Makefile:1342: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2
make[1]: Leaving directory '/home/andreas/OBS/u-boot/ci20' Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

I've reviewed all SPL Kconfig options and found three seemingly unneeded options defaulting to y, but I did not find a way to get this number down even a single byte with my GCC 6.3.1, and the recommended 4.8.1 was even worse (~748).

Quoted 20 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

I'm looking into a gcc7 package next, but that'll take a bit.

I don't think that's gonna help with U-Boot's bloat. [...]

Yeah, slightly down with GCC 7.0.1, but not much:

Right, it's the new bloat ...

Quoted 12 lines

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 264 bytes ../scripts/Makefile.spl:304: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1 /home/andreas/OBS/u-boot/Makefile:1342: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2
make[1]: Leaving directory '/home/andreas/OBS/u-boot/ci20' Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

Update: I've rebased the patchset to latest master (8cb3ce64f936f5dedbcfc1935c5caf31bb682474 / "Merge
git://git.denx.de/u-boot-dm") - BMIPS caused trivial conflicts, and DM API changes needed to be accounted for.

https://github.com/afaerber/u-boot/commits/ci20

By further disabling CONFIG_SPL_RAW_IMAGE_SUPPORT in the ci20 defconfig I am now at 344 bytes overflow (gcc 7.1.1):

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 344 bytes ../scripts/Makefile.spl:333: recipe for target 'spl/u-boot-spl' failed make[2]: *** [spl/u-boot-spl] Error 1 /home/andreas/OBS/u-boot/Makefile:1382: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2

By disabling SPL GPIO support and hardcoding a board revision instead of detecting it via GPIOs, I can get it down to 80 bytes.

Quoted 6 lines

By aggressively adding #ifndef CONFIG_SPL_BUILD in ci20.c I'm down to 64 bytes, but not sure if some of that is actually needed for SPL...

Tom, do you see a chance of merging any of the drivers without the whole board building, so that we can reduce the rebasing work and get a common base for optimizing?

Yes, I would be agreeable to that, especially if say they can be enabled also on qemu-mips so we have build but not run time testing and thus aren't adding dead code.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170612/1aa80c0e/attachment.sig>
#32 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

In reply to Andreas Färber

Am 12.02.2017 um 12:52 schrieb Andreas F?rber:

Quoted 40 lines

Hi Marek,

Am 01.12.2016 um 02:06 schrieb Marek Vasut:

Quoted 28 lines

From: Paul Burton <[email protected]>

Add support for the Creator CI20 platform based on the JZ4780 SoC. The DTS file comes from Linux 4.6 as of revision 78800558d104e003f9ae92e0107f1de39cf9de9f

So far, there are still a few details which will have to be fixed once they are fleshed out in Linux:
- pinmux: Thus far, this board just pokes the pinmux registers to set the pinmux. For MMC in SPL, this will have to stay. But for full u-boot a proper pinmux driver will have to be added once the pinmux semantics in DT are in mainline Linux.
- ethernet,efuse: DT bindings are missing from mainline Linux.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 arch/mips/dts/Makefile        |   1 +
 arch/mips/dts/ci20.dts        | 114 ++++++++++++++
 arch/mips/mach-jz47xx/Kconfig |  11 ++
 board/imgtec/ci20/Kconfig     |  35 +++++
 board/imgtec/ci20/Makefile    |   5 +
 board/imgtec/ci20/README      |  10 ++
 board/imgtec/ci20/ci20.c      | 354 ++++++++++++++++++++++++++++++++++++++++++
 configs/ci20_defconfig        |  28 ++++
 include/configs/ci20.h        | 105 +++++++++++++
Quoted 8 lines
 9 files changed, 663 insertions(+)
 create mode 100644 arch/mips/dts/ci20.dts
 create mode 100644 board/imgtec/ci20/Kconfig
 create mode 100644 board/imgtec/ci20/Makefile
 create mode 100644 board/imgtec/ci20/README
 create mode 100644 board/imgtec/ci20/ci20.c
 create mode 100644 configs/ci20_defconfig
 create mode 100644 include/configs/ci20.h
Quoted 7 lines

I've looked into testing the remainder of this patchset, not seeing a newer version. You can find my branch here:

https://github.com/afaerber/u-boot/commits/ci20

In particular I fixed the MMC set_ios signature to silence a warning about the int vs. void return type, which I intend to clean up and submit.

Erm, I realized that the MMC driver is among the patches not yet merged, so it'll have to be fixed in the next respin.

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
#33 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

In reply to Andreas Färber
Quoted 44 lines · Andreas F?rber

Hi Marek,

Am 01.12.2016 um 02:06 schrieb Marek Vasut:

Quoted 28 lines

From: Paul Burton <[email protected]>

Add support for the Creator CI20 platform based on the JZ4780 SoC. The DTS file comes from Linux 4.6 as of revision 78800558d104e003f9ae92e0107f1de39cf9de9f

So far, there are still a few details which will have to be fixed once they are fleshed out in Linux:
- pinmux: Thus far, this board just pokes the pinmux registers to set the pinmux. For MMC in SPL, this will have to stay. But for full u-boot a proper pinmux driver will have to be added once the pinmux semantics in DT are in mainline Linux.
- ethernet,efuse: DT bindings are missing from mainline Linux.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 arch/mips/dts/Makefile        |   1 +
 arch/mips/dts/ci20.dts        | 114 ++++++++++++++
 arch/mips/mach-jz47xx/Kconfig |  11 ++
 board/imgtec/ci20/Kconfig     |  35 +++++
 board/imgtec/ci20/Makefile    |   5 +
 board/imgtec/ci20/README      |  10 ++
 board/imgtec/ci20/ci20.c      | 354 ++++++++++++++++++++++++++++++++++++++++++
 configs/ci20_defconfig        |  28 ++++
 include/configs/ci20.h        | 105 +++++++++++++
Quoted 8 lines
 9 files changed, 663 insertions(+)
 create mode 100644 arch/mips/dts/ci20.dts
 create mode 100644 board/imgtec/ci20/Kconfig
 create mode 100644 board/imgtec/ci20/Makefile
 create mode 100644 board/imgtec/ci20/README
 create mode 100644 board/imgtec/ci20/ci20.c
 create mode 100644 configs/ci20_defconfig
 create mode 100644 include/configs/ci20.h

I've looked into testing the remainder of this patchset, not seeing a newer version. You can find my branch here:

https://github.com/afaerber/u-boot/commits/ci20

[snip]

Quoted 4 lines

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 288 bytes

I can recreate that too here real quick, but can't test out changes on my Ci20 right now. Can you try:

include/configs/ci20.h +2 -2
index 4503adb..9e2ad7b 100644
@@ -70,10 +70,10 @@
 /* SPL */
 #define CONFIG_SPL_FRAMEWORK
 
-#define CONFIG_SPL_STACK		0xf4008000 /* only max. 2KB spare! */
+#define CONFIG_SPL_STACK		0xf4008200 /* only max. 1.5KB spare! */
 
 #define CONFIG_SPL_TEXT_BASE		0xf4000a00
-#define CONFIG_SPL_MAX_SIZE		((14 * 1024) - 0xa00)
+#define CONFIG_SPL_MAX_SIZE		((14 * 1024) - 0x800)
 
 #define CONFIG_SPL_BSS_START_ADDR	0xf4004000
 #define CONFIG_SPL_BSS_MAX_SIZE		0x00002000 /* 512KB, arbitrary */

Now, off the top of my head I'm only giving myself a 50/50 chance of having moved the stack address in the correct direction. And note that I don't know why we say only max of 2KB for stack, and then ensure we have 2.5KB of room, but I've shifted 512 bytes from one side to the other. And it's quite probable that we should make use having SPL stack get moved into DDR, but I don't have the memory map handy either (and based on the above snippets I'm confused as CONFIG_SPL_BSS_START_ADDR should be in DDR space, I don't know if internal memory directly follows into DDR here or what).

I do want to reiterate that I am eager to have Ci20 be working in mainline as I have one and I want to figure out how to include it in my farm, or at least manual testing from time to time. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170214/dc0a1d45/attachment.sig>
#34 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

Quoted 59 lines · Tom Rini
Quoted 44 lines · Andreas F?rber

Hi Marek,

Am 01.12.2016 um 02:06 schrieb Marek Vasut:

Quoted 28 lines

From: Paul Burton <[email protected]>

Add support for the Creator CI20 platform based on the JZ4780 SoC. The DTS file comes from Linux 4.6 as of revision 78800558d104e003f9ae92e0107f1de39cf9de9f

So far, there are still a few details which will have to be fixed once they are fleshed out in Linux:
- pinmux: Thus far, this board just pokes the pinmux registers to set the pinmux. For MMC in SPL, this will have to stay. But for full u-boot a proper pinmux driver will have to be added once the pinmux semantics in DT are in mainline Linux.
- ethernet,efuse: DT bindings are missing from mainline Linux.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 arch/mips/dts/Makefile        |   1 +
 arch/mips/dts/ci20.dts        | 114 ++++++++++++++
 arch/mips/mach-jz47xx/Kconfig |  11 ++
 board/imgtec/ci20/Kconfig     |  35 +++++
 board/imgtec/ci20/Makefile    |   5 +
 board/imgtec/ci20/README      |  10 ++
 board/imgtec/ci20/ci20.c      | 354 ++++++++++++++++++++++++++++++++++++++++++
 configs/ci20_defconfig        |  28 ++++
 include/configs/ci20.h        | 105 +++++++++++++
Quoted 8 lines
 9 files changed, 663 insertions(+)
 create mode 100644 arch/mips/dts/ci20.dts
 create mode 100644 board/imgtec/ci20/Kconfig
 create mode 100644 board/imgtec/ci20/Makefile
 create mode 100644 board/imgtec/ci20/README
 create mode 100644 board/imgtec/ci20/ci20.c
 create mode 100644 configs/ci20_defconfig
 create mode 100644 include/configs/ci20.h

I've looked into testing the remainder of this patchset, not seeing a newer version. You can find my branch here:

https://github.com/afaerber/u-boot/commits/ci20

[snip]

Quoted 4 lines

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 288 bytes

I can recreate that too here real quick, but can't test out changes on my Ci20 right now. Can you try:

include/configs/ci20.h +0 -0
index 4503adb..9e2ad7b 100644

include/configs/ci20.h line 76

Quoted 9 lines
include/configs/ci20.h +2 -2
@@ -70,10 +70,10 @@
 /* SPL */
 #define CONFIG_SPL_FRAMEWORK
 
-#define CONFIG_SPL_STACK		0xf4008000 /* only max. 2KB spare! */
+#define CONFIG_SPL_STACK		0xf4008200 /* only max. 1.5KB spare! */
 
 #define CONFIG_SPL_TEXT_BASE		0xf4000a00
-#define CONFIG_SPL_MAX_SIZE		((14 * 1024) - 0xa00)
+#define CONFIG_SPL_MAX_SIZE		((14 * 1024) - 0x800)

This will not work, the stack is configured at it's limit already.

Quoted 10 lines
include/configs/ci20.h +0 -0
 #define CONFIG_SPL_BSS_START_ADDR	0xf4004000
 #define CONFIG_SPL_BSS_MAX_SIZE		0x00002000 /* 512KB, arbitrary */
 

Now, off the top of my head I'm only giving myself a 50/50 chance of having moved the stack address in the correct direction. And note that I don't know why we say only max of 2KB for stack, and then ensure we have 2.5KB of room, but I've shifted 512 bytes from one side to the other. And it's quite probable that we should make use having SPL stack get moved into DDR

You mean the DDR which you init in the SPL ? :)

Quoted 8 lines

, but I don't have the memory map handy either (and
based on the above snippets I'm confused as CONFIG_SPL_BSS_START_ADDR should be in DDR space, I don't know if internal memory directly follows into DDR here or what).

I do want to reiterate that I am eager to have Ci20 be working in mainline as I have one and I want to figure out how to include it in my farm, or at least manual testing from time to time. Thanks!

Well, these patches were rotting on the list for year or so without getting any attention, until the point I had to scream on the IRC to get ANY review comments, multiple times, so I really see a lot of interest in getting this in, indeed :)

Signature · 2 lines
Best regards,
Marek Vasut
#35 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

Quoted 76 lines · Marek Vasut
Quoted 59 lines · Tom Rini
Quoted 44 lines · Andreas F?rber

Hi Marek,

Am 01.12.2016 um 02:06 schrieb Marek Vasut:

Quoted 28 lines

From: Paul Burton <[email protected]>

Add support for the Creator CI20 platform based on the JZ4780 SoC. The DTS file comes from Linux 4.6 as of revision 78800558d104e003f9ae92e0107f1de39cf9de9f

So far, there are still a few details which will have to be fixed once they are fleshed out in Linux:
- pinmux: Thus far, this board just pokes the pinmux registers to set the pinmux. For MMC in SPL, this will have to stay. But for full u-boot a proper pinmux driver will have to be added once the pinmux semantics in DT are in mainline Linux.
- ethernet,efuse: DT bindings are missing from mainline Linux.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 arch/mips/dts/Makefile        |   1 +
 arch/mips/dts/ci20.dts        | 114 ++++++++++++++
 arch/mips/mach-jz47xx/Kconfig |  11 ++
 board/imgtec/ci20/Kconfig     |  35 +++++
 board/imgtec/ci20/Makefile    |   5 +
 board/imgtec/ci20/README      |  10 ++
 board/imgtec/ci20/ci20.c      | 354 ++++++++++++++++++++++++++++++++++++++++++
 configs/ci20_defconfig        |  28 ++++
 include/configs/ci20.h        | 105 +++++++++++++
Quoted 8 lines
 9 files changed, 663 insertions(+)
 create mode 100644 arch/mips/dts/ci20.dts
 create mode 100644 board/imgtec/ci20/Kconfig
 create mode 100644 board/imgtec/ci20/Makefile
 create mode 100644 board/imgtec/ci20/README
 create mode 100644 board/imgtec/ci20/ci20.c
 create mode 100644 configs/ci20_defconfig
 create mode 100644 include/configs/ci20.h

I've looked into testing the remainder of this patchset, not seeing a newer version. You can find my branch here:

https://github.com/afaerber/u-boot/commits/ci20

[snip]

Quoted 4 lines

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 288 bytes

I can recreate that too here real quick, but can't test out changes on my Ci20 right now. Can you try:

include/configs/ci20.h +0 -0
index 4503adb..9e2ad7b 100644

include/configs/ci20.h line 76

Quoted 9 lines
include/configs/ci20.h +2 -2
@@ -70,10 +70,10 @@
 /* SPL */
 #define CONFIG_SPL_FRAMEWORK
 
-#define CONFIG_SPL_STACK		0xf4008000 /* only max. 2KB spare! */
+#define CONFIG_SPL_STACK		0xf4008200 /* only max. 1.5KB spare! */
 
 #define CONFIG_SPL_TEXT_BASE		0xf4000a00
-#define CONFIG_SPL_MAX_SIZE		((14 * 1024) - 0xa00)
+#define CONFIG_SPL_MAX_SIZE		((14 * 1024) - 0x800)

This will not work, the stack is configured at it's limit already.

Quoted 4 lines
include/configs/ci20.h +0 -0
 #define CONFIG_SPL_BSS_START_ADDR	0xf4004000
 #define CONFIG_SPL_BSS_MAX_SIZE		0x00002000 /* 512KB, arbitrary */
 
Quoted 8 lines
Quoted 6 lines

Now, off the top of my head I'm only giving myself a 50/50 chance of having moved the stack address in the correct direction. And note that I don't know why we say only max of 2KB for stack, and then ensure we have 2.5KB of room, but I've shifted 512 bytes from one side to the other. And it's quite probable that we should make use having SPL stack get moved into DDR

You mean the DDR which you init in the SPL ? :)

Yes, I mean the DDR which we init in the SPL, after we've init'd it, so that we can work more comfortably in cramped and constrained spaces.

Quoted 5 lines
Quoted 5 lines

, but I don't have the memory map handy either (and
based on the above snippets I'm confused as CONFIG_SPL_BSS_START_ADDR should be in DDR space, I don't know if internal memory directly follows into DDR here or what).

Quoted 8 lines
Quoted 3 lines

I do want to reiterate that I am eager to have Ci20 be working in mainline as I have one and I want to figure out how to include it in my farm, or at least manual testing from time to time. Thanks!

Well, these patches were rotting on the list for year or so without getting any attention, until the point I had to scream on the IRC to get ANY review comments, multiple times, so I really see a lot of interest in getting this in, indeed :)

Yeah, I feel bad about not having more time for all of the various things I'd like to see happen, happen. But that's why I bought the Ci20 and Ci40 (and some other boards) as a regular person rather than try and get a freebie.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170214/04cd84c6/attachment.sig>
#36 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

Quoted 84 lines · Tom Rini
Quoted 83 lines · Marek Vasut
Quoted 59 lines · Tom Rini
Quoted 44 lines · Andreas F?rber

Hi Marek,

Am 01.12.2016 um 02:06 schrieb Marek Vasut:

Quoted 28 lines

From: Paul Burton <[email protected]>

Add support for the Creator CI20 platform based on the JZ4780 SoC. The DTS file comes from Linux 4.6 as of revision 78800558d104e003f9ae92e0107f1de39cf9de9f

So far, there are still a few details which will have to be fixed once they are fleshed out in Linux:
- pinmux: Thus far, this board just pokes the pinmux registers to set the pinmux. For MMC in SPL, this will have to stay. But for full u-boot a proper pinmux driver will have to be added once the pinmux semantics in DT are in mainline Linux.
- ethernet,efuse: DT bindings are missing from mainline Linux.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 arch/mips/dts/Makefile        |   1 +
 arch/mips/dts/ci20.dts        | 114 ++++++++++++++
 arch/mips/mach-jz47xx/Kconfig |  11 ++
 board/imgtec/ci20/Kconfig     |  35 +++++
 board/imgtec/ci20/Makefile    |   5 +
 board/imgtec/ci20/README      |  10 ++
 board/imgtec/ci20/ci20.c      | 354 ++++++++++++++++++++++++++++++++++++++++++
 configs/ci20_defconfig        |  28 ++++
 include/configs/ci20.h        | 105 +++++++++++++
Quoted 8 lines
 9 files changed, 663 insertions(+)
 create mode 100644 arch/mips/dts/ci20.dts
 create mode 100644 board/imgtec/ci20/Kconfig
 create mode 100644 board/imgtec/ci20/Makefile
 create mode 100644 board/imgtec/ci20/README
 create mode 100644 board/imgtec/ci20/ci20.c
 create mode 100644 configs/ci20_defconfig
 create mode 100644 include/configs/ci20.h

I've looked into testing the remainder of this patchset, not seeing a newer version. You can find my branch here:

https://github.com/afaerber/u-boot/commits/ci20

[snip]

Quoted 4 lines

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 288 bytes

I can recreate that too here real quick, but can't test out changes on my Ci20 right now. Can you try:

include/configs/ci20.h +0 -0
index 4503adb..9e2ad7b 100644

include/configs/ci20.h line 76

Quoted 9 lines
include/configs/ci20.h +2 -2
@@ -70,10 +70,10 @@
 /* SPL */
 #define CONFIG_SPL_FRAMEWORK
 
-#define CONFIG_SPL_STACK		0xf4008000 /* only max. 2KB spare! */
+#define CONFIG_SPL_STACK		0xf4008200 /* only max. 1.5KB spare! */
 
 #define CONFIG_SPL_TEXT_BASE		0xf4000a00
-#define CONFIG_SPL_MAX_SIZE		((14 * 1024) - 0xa00)
+#define CONFIG_SPL_MAX_SIZE		((14 * 1024) - 0x800)

This will not work, the stack is configured at it's limit already.

Quoted 10 lines
include/configs/ci20.h +0 -0
 #define CONFIG_SPL_BSS_START_ADDR	0xf4004000
 #define CONFIG_SPL_BSS_MAX_SIZE		0x00002000 /* 512KB, arbitrary */
 

Now, off the top of my head I'm only giving myself a 50/50 chance of having moved the stack address in the correct direction. And note that I don't know why we say only max of 2KB for stack, and then ensure we have 2.5KB of room, but I've shifted 512 bytes from one side to the other. And it's quite probable that we should make use having SPL stack get moved into DDR

Quoted 4 lines
Quoted 1 line

You mean the DDR which you init in the SPL ? :)

Yes, I mean the DDR which we init in the SPL, after we've init'd it, so that we can work more comfortably in cramped and constrained spaces.

You know, you are still limited by the 14 kiB load limit of the BootROM. I think there's more than 16 kiB of SRAM total, so there's no real problem with the stack. The problem is that 14 kiB load limit of the BootROM, it will NOT LOAD MORE than 14 kiB of code . I tried (because, well, 14 kiB is too small). IT DOES NOT WORK.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

, but I don't have the memory map handy either (and
based on the above snippets I'm confused as CONFIG_SPL_BSS_START_ADDR should be in DDR space, I don't know if internal memory directly follows into DDR here or what).

I do want to reiterate that I am eager to have Ci20 be working in mainline as I have one and I want to figure out how to include it in my farm, or at least manual testing from time to time. Thanks!

Quoted 7 lines
Quoted 4 lines

Well, these patches were rotting on the list for year or so without getting any attention, until the point I had to scream on the IRC to get ANY review comments, multiple times, so I really see a lot of interest in getting this in, indeed :)

Yeah, I feel bad about not having more time for all of the various things I'd like to see happen, happen.

You should ! ;-)

Quoted 3 lines

But that's why I bought the Ci20
and Ci40 (and some other boards) as a regular person rather than try and get a freebie.

I feel triggered by this, I also bought the CI20 (and not CI40, because it wasn't available ... but I will buy one eventually when I feel like delving into more masochistic stuff ...)

Signature · 2 lines
Best regards,
Marek Vasut
#37 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

Quoted 87 lines · Marek Vasut
Quoted 86 lines · Tom Rini
Quoted 84 lines · Marek Vasut
Quoted 59 lines · Tom Rini
Quoted 44 lines · Andreas F?rber

Hi Marek,

Am 01.12.2016 um 02:06 schrieb Marek Vasut:

Quoted 28 lines

From: Paul Burton <[email protected]>

Add support for the Creator CI20 platform based on the JZ4780 SoC. The DTS file comes from Linux 4.6 as of revision 78800558d104e003f9ae92e0107f1de39cf9de9f

So far, there are still a few details which will have to be fixed once they are fleshed out in Linux:
- pinmux: Thus far, this board just pokes the pinmux registers to set the pinmux. For MMC in SPL, this will have to stay. But for full u-boot a proper pinmux driver will have to be added once the pinmux semantics in DT are in mainline Linux.
- ethernet,efuse: DT bindings are missing from mainline Linux.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 arch/mips/dts/Makefile        |   1 +
 arch/mips/dts/ci20.dts        | 114 ++++++++++++++
 arch/mips/mach-jz47xx/Kconfig |  11 ++
 board/imgtec/ci20/Kconfig     |  35 +++++
 board/imgtec/ci20/Makefile    |   5 +
 board/imgtec/ci20/README      |  10 ++
 board/imgtec/ci20/ci20.c      | 354 ++++++++++++++++++++++++++++++++++++++++++
 configs/ci20_defconfig        |  28 ++++
 include/configs/ci20.h        | 105 +++++++++++++
Quoted 8 lines
 9 files changed, 663 insertions(+)
 create mode 100644 arch/mips/dts/ci20.dts
 create mode 100644 board/imgtec/ci20/Kconfig
 create mode 100644 board/imgtec/ci20/Makefile
 create mode 100644 board/imgtec/ci20/README
 create mode 100644 board/imgtec/ci20/ci20.c
 create mode 100644 configs/ci20_defconfig
 create mode 100644 include/configs/ci20.h

I've looked into testing the remainder of this patchset, not seeing a newer version. You can find my branch here:

https://github.com/afaerber/u-boot/commits/ci20

[snip]

Quoted 4 lines

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 288 bytes

I can recreate that too here real quick, but can't test out changes on my Ci20 right now. Can you try:

include/configs/ci20.h +0 -0
index 4503adb..9e2ad7b 100644

include/configs/ci20.h line 76

Quoted 9 lines
include/configs/ci20.h +2 -2
@@ -70,10 +70,10 @@
 /* SPL */
 #define CONFIG_SPL_FRAMEWORK
 
-#define CONFIG_SPL_STACK		0xf4008000 /* only max. 2KB spare! */
+#define CONFIG_SPL_STACK		0xf4008200 /* only max. 1.5KB spare! */
 
 #define CONFIG_SPL_TEXT_BASE		0xf4000a00
-#define CONFIG_SPL_MAX_SIZE		((14 * 1024) - 0xa00)
+#define CONFIG_SPL_MAX_SIZE		((14 * 1024) - 0x800)

This will not work, the stack is configured at it's limit already.

Quoted 10 lines
include/configs/ci20.h +0 -0
 #define CONFIG_SPL_BSS_START_ADDR	0xf4004000
 #define CONFIG_SPL_BSS_MAX_SIZE		0x00002000 /* 512KB, arbitrary */
 

Now, off the top of my head I'm only giving myself a 50/50 chance of having moved the stack address in the correct direction. And note that I don't know why we say only max of 2KB for stack, and then ensure we have 2.5KB of room, but I've shifted 512 bytes from one side to the other. And it's quite probable that we should make use having SPL stack get moved into DDR

You mean the DDR which you init in the SPL ? :)

Quoted 8 lines
Quoted 2 lines

Yes, I mean the DDR which we init in the SPL, after we've init'd it, so that we can work more comfortably in cramped and constrained spaces.

You know, you are still limited by the 14 kiB load limit of the BootROM. I think there's more than 16 kiB of SRAM total, so there's no real problem with the stack. The problem is that 14 kiB load limit of the BootROM, it will NOT LOAD MORE than 14 kiB of code . I tried (because, well, 14 kiB is too small). IT DOES NOT WORK.

Can we use those last 2KiB of SRAM for our stack or does that freak out the BootROM? If so, we should tweak the above definitions to set the hard limit at 14 * SZ_1K and put stack at 0xf4004200 ? Where is 0xf4008000 in the memory map?

Quoted 19 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

, but I don't have the memory map handy either (and
based on the above snippets I'm confused as CONFIG_SPL_BSS_START_ADDR should be in DDR space, I don't know if internal memory directly follows into DDR here or what).

I do want to reiterate that I am eager to have Ci20 be working in mainline as I have one and I want to figure out how to include it in my farm, or at least manual testing from time to time. Thanks!

Quoted 7 lines
Quoted 4 lines

Well, these patches were rotting on the list for year or so without getting any attention, until the point I had to scream on the IRC to get ANY review comments, multiple times, so I really see a lot of interest in getting this in, indeed :)

Yeah, I feel bad about not having more time for all of the various things I'd like to see happen, happen.

You should ! ;-)

Quoted 7 lines
Quoted 3 lines

But that's why I bought the Ci20
and Ci40 (and some other boards) as a regular person rather than try and get a freebie.

I feel triggered by this, I also bought the CI20 (and not CI40, because it wasn't available ... but I will buy one eventually when I feel like delving into more masochistic stuff ...)

Sorry, I was trying to point out that I have this board (and some others) that I've purchased and would like to have mainline U-Boot on, but cannot as I have not the time to try and pick them up as project boards. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170215/d334395c/attachment.sig>
#38 lore raw

PATCH 13/13 mips: jz47xx: Add Creator CI20 platform

Quoted 91 lines · Tom Rini
Quoted 90 lines · Marek Vasut
Quoted 88 lines · Tom Rini
Quoted 76 lines · Marek Vasut
Quoted 59 lines · Tom Rini
Quoted 44 lines · Andreas F?rber

Hi Marek,

Am 01.12.2016 um 02:06 schrieb Marek Vasut:

Quoted 28 lines

From: Paul Burton <[email protected]>

Add support for the Creator CI20 platform based on the JZ4780 SoC. The DTS file comes from Linux 4.6 as of revision 78800558d104e003f9ae92e0107f1de39cf9de9f

So far, there are still a few details which will have to be fixed once they are fleshed out in Linux:
- pinmux: Thus far, this board just pokes the pinmux registers to set the pinmux. For MMC in SPL, this will have to stay. But for full u-boot a proper pinmux driver will have to be added once the pinmux semantics in DT are in mainline Linux.
- ethernet,efuse: DT bindings are missing from mainline Linux.

Cc Daniel Schwierzeck <[email protected]>
Cc Paul Burton <[email protected]>
---
 arch/mips/dts/Makefile        |   1 +
 arch/mips/dts/ci20.dts        | 114 ++++++++++++++
 arch/mips/mach-jz47xx/Kconfig |  11 ++
 board/imgtec/ci20/Kconfig     |  35 +++++
 board/imgtec/ci20/Makefile    |   5 +
 board/imgtec/ci20/README      |  10 ++
 board/imgtec/ci20/ci20.c      | 354 ++++++++++++++++++++++++++++++++++++++++++
 configs/ci20_defconfig        |  28 ++++
 include/configs/ci20.h        | 105 +++++++++++++
Quoted 8 lines
 9 files changed, 663 insertions(+)
 create mode 100644 arch/mips/dts/ci20.dts
 create mode 100644 board/imgtec/ci20/Kconfig
 create mode 100644 board/imgtec/ci20/Makefile
 create mode 100644 board/imgtec/ci20/README
 create mode 100644 board/imgtec/ci20/ci20.c
 create mode 100644 configs/ci20_defconfig
 create mode 100644 include/configs/ci20.h

I've looked into testing the remainder of this patchset, not seeing a newer version. You can find my branch here:

https://github.com/afaerber/u-boot/commits/ci20

[snip]

Quoted 4 lines

LD spl/u-boot-spl
mipsel-suse-linux-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
mipsel-suse-linux-ld.bfd: region `.sram' overflowed by 288 bytes

I can recreate that too here real quick, but can't test out changes on my Ci20 right now. Can you try:

include/configs/ci20.h +0 -0
index 4503adb..9e2ad7b 100644

include/configs/ci20.h line 76

Quoted 9 lines
include/configs/ci20.h +2 -2
@@ -70,10 +70,10 @@
 /* SPL */
 #define CONFIG_SPL_FRAMEWORK
 
-#define CONFIG_SPL_STACK		0xf4008000 /* only max. 2KB spare! */
+#define CONFIG_SPL_STACK		0xf4008200 /* only max. 1.5KB spare! */
 
 #define CONFIG_SPL_TEXT_BASE		0xf4000a00
-#define CONFIG_SPL_MAX_SIZE		((14 * 1024) - 0xa00)
+#define CONFIG_SPL_MAX_SIZE		((14 * 1024) - 0x800)

This will not work, the stack is configured at it's limit already.

Quoted 4 lines
include/configs/ci20.h +0 -0
 #define CONFIG_SPL_BSS_START_ADDR	0xf4004000
 #define CONFIG_SPL_BSS_MAX_SIZE		0x00002000 /* 512KB, arbitrary */
 
Quoted 8 lines
Quoted 6 lines

Now, off the top of my head I'm only giving myself a 50/50 chance of having moved the stack address in the correct direction. And note that I don't know why we say only max of 2KB for stack, and then ensure we have 2.5KB of room, but I've shifted 512 bytes from one side to the other. And it's quite probable that we should make use having SPL stack get moved into DDR

You mean the DDR which you init in the SPL ? :)

Yes, I mean the DDR which we init in the SPL, after we've init'd it, so that we can work more comfortably in cramped and constrained spaces.

Quoted 8 lines
Quoted 5 lines

You know, you are still limited by the 14 kiB load limit of the BootROM. I think there's more than 16 kiB of SRAM total, so there's no real problem with the stack. The problem is that 14 kiB load limit of the BootROM, it will NOT LOAD MORE than 14 kiB of code . I tried (because, well, 14 kiB is too small). IT DOES NOT WORK.

Can we use those last 2KiB of SRAM for our stack or does that freak out the BootROM?

IIRC I tried pretty much everything to squeeze more space out of this chip and this is the only thing that worked.

Quoted 2 lines

If so, we should tweak the above definitions to set the hard limit at 14 * SZ_1K and put stack at 0xf4004200 ?

Be my guest, research the hell out of this ... if you can figure something out, great.

Quoted 1 line

Where is 0xf4008000 in the memory map?

RTFM , seriously ...

Quoted 23 lines
Quoted 23 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

, but I don't have the memory map handy either (and
based on the above snippets I'm confused as CONFIG_SPL_BSS_START_ADDR should be in DDR space, I don't know if internal memory directly follows into DDR here or what).

I do want to reiterate that I am eager to have Ci20 be working in mainline as I have one and I want to figure out how to include it in my farm, or at least manual testing from time to time. Thanks!

Quoted 7 lines
Quoted 4 lines

Well, these patches were rotting on the list for year or so without getting any attention, until the point I had to scream on the IRC to get ANY review comments, multiple times, so I really see a lot of interest in getting this in, indeed :)

Yeah, I feel bad about not having more time for all of the various things I'd like to see happen, happen.

You should ! ;-)

Quoted 3 lines

But that's why I bought the Ci20
and Ci40 (and some other boards) as a regular person rather than try and get a freebie.

Quoted 8 lines
Quoted 3 lines

I feel triggered by this, I also bought the CI20 (and not CI40, because it wasn't available ... but I will buy one eventually when I feel like delving into more masochistic stuff ...)

Sorry, I was trying to point out that I have this board (and some others) that I've purchased and would like to have mainline U-Boot on, but cannot as I have not the time to try and pick them up as project boards. Thanks!

Well, I also don't have the time to keep rebasing this patchset over and over and over and solving why the hell does it no longer fit AGAIN. So too bad ...

Signature · 2 lines
Best regards,
Marek Vasut
#39 lore raw

PATCH 1/13 serial: 16550: Add getfcr accessor

In reply to Marek Vasut
Quoted 15 lines · Marek Vasut

Add function which allows fetching the default FCR register setting from platform data for DM , while retaining old behavior for non-DM by returning UART_FCRVAL.

---
V2: If CONFIG_DM_SERIAL and DEBUG_UART are enabled, the ns16550_getfcr()
can be invoked with NULL plat data . Check for this case and return the default UART_FCRVAL then.
V3: It turns out that if DEBUG_UART is defined, $port points directly to
hardware registers. Add additional ifdef to handle the case where debug uart is enabled with DM_SERIAL correctly.
V4: Use UART_FCRVAL in _debug_uart_init() directly

Quoted 4 lines
---
 drivers/serial/ns16550.c | 18 ++++++++++++++++--
 include/ns16550.h        |  1 +
 2 files changed, 17 insertions(+), 2 deletions(-)

But I think you are missing the 'v4' tag in your email subject.

#40 lore raw

PATCH 1/13 serial: 16550: Add getfcr accessor

In reply to Marek Vasut
Quoted 8 lines · Marek Vasut

Add function which allows fetching the default FCR register setting from platform data for DM , while retaining old behavior for non-DM by returning UART_FCRVAL.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161219/5a9e136b/attachment.sig>