mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/5] commands: mmc_extcsd: print_field: fix 32 bit overflow
@ 2020-09-09 11:01 Juergen Borleis
  2020-09-09 11:01 ` [PATCH 2/5] commands: mmc_extcsd: print_field: fix layout Juergen Borleis
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Juergen Borleis @ 2020-09-09 11:01 UTC (permalink / raw)
  To: barebox; +Cc: Juergen Borleis

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
---
 commands/mmc_extcsd.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/commands/mmc_extcsd.c b/commands/mmc_extcsd.c
index c9a28fb1fe..40d11df17d 100644
--- a/commands/mmc_extcsd.c
+++ b/commands/mmc_extcsd.c
@@ -11,6 +11,7 @@
 #include <mci.h>
 #include <getopt.h>
 #include <fs.h>
+#include <linux/sizes.h>
 
 #define EXT_CSD_BLOCKSIZE	512
 
@@ -1142,7 +1143,7 @@ static int print_field(u8 *reg, int index)
 		return 1;
 
 	case EXT_CSD_SEC_COUNT:
-		tmp64 = val * 512;
+		tmp64 *= 512;
 		printf("\tDevice density: %llu B\n", tmp64);
 		return 1;
 
@@ -1232,7 +1233,7 @@ static int print_field(u8 *reg, int index)
 
 	case EXT_CSD_HC_ERASE_GRP_SIZE:
 		val = get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
-		val = val * 524288;
+		val = val * SZ_512K;
 		if (val)
 			str = basprintf("Erase-unit size: %u", val);
 		else
@@ -1342,7 +1343,8 @@ static int print_field(u8 *reg, int index)
 	case EXT_CSD_ENH_SIZE_MULT:
 		tmp = get_field_val(EXT_CSD_HC_WP_GRP_SIZE, 0, 0xFF);
 		tmp = tmp + get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
-		tmp64 = val * tmp * 524288;
+		tmp64 *= tmp;
+		tmp64 *= SZ_512K;
 		printf("\tEnhanced User Data Area %i Size: %llu B\n",
 				index - EXT_CSD_ENH_SIZE_MULT, tmp64);
 		return 1;
@@ -1350,28 +1352,32 @@ static int print_field(u8 *reg, int index)
 	case EXT_CSD_GP_SIZE_MULT3:
 		tmp = get_field_val(EXT_CSD_HC_WP_GRP_SIZE, 0, 0xFF);
 		tmp = tmp + get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
-		tmp64 = val * tmp * 524288;
+		tmp64 *= tmp;
+		tmp64 *= SZ_512K;
 		printf("\tGeneral_Purpose_Partition_3 Size: %llu B\n", tmp64);
 		return 1;
 
 	case EXT_CSD_GP_SIZE_MULT2:
 		tmp = get_field_val(EXT_CSD_HC_WP_GRP_SIZE, 0, 0xFF);
 		tmp = tmp + get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
-		tmp64 = val * tmp * 524288;
+		tmp64 *= tmp;
+		tmp64 *= SZ_512K;
 		printf("\tGeneral_Purpose_Partition_2 Size: %llu B\n", tmp64);
 		return 1;
 
 	case EXT_CSD_GP_SIZE_MULT1:
 		tmp = get_field_val(EXT_CSD_HC_WP_GRP_SIZE, 0, 0xFF);
 		tmp = tmp + get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
-		tmp64 = val * tmp * 524288;
+		tmp64 *= tmp;
+		tmp64 *= SZ_512K;
 		printf("\tGeneral_Purpose_Partition_1 Size: %llu B\n", tmp64);
 		return 1;
 
 	case EXT_CSD_GP_SIZE_MULT0:
 		tmp = get_field_val(EXT_CSD_HC_WP_GRP_SIZE, 0, 0xFF);
 		tmp = tmp + get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
-		tmp64 = val * tmp * 524288;
+		tmp64 *= tmp;
+		tmp64 *= SZ_512K;
 		printf("\tGeneral_Purpose_Partition_0 Size: %llu B\n", tmp64);
 		return 1;
 
@@ -1422,7 +1428,8 @@ static int print_field(u8 *reg, int index)
 	case EXT_CSD_MAX_ENH_SIZE_MULT:
 		tmp = get_field_val(EXT_CSD_HC_WP_GRP_SIZE, 0, 0xFF);
 		tmp = tmp + get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
-		tmp64 = val * tmp * 524288;
+		tmp64 *= tmp;
+		tmp64 *= SZ_512K;
 		printf("\tMax Enhanced Area: %llu B\n", tmp64);
 		return 1;
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/5] commands: mmc_extcsd: print_field: fix layout
  2020-09-09 11:01 [PATCH 1/5] commands: mmc_extcsd: print_field: fix 32 bit overflow Juergen Borleis
@ 2020-09-09 11:01 ` Juergen Borleis
  2020-09-09 11:01 ` [PATCH 3/5] mci: mci-core: fix long lasting FIXMEs Juergen Borleis
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Juergen Borleis @ 2020-09-09 11:01 UTC (permalink / raw)
  To: barebox; +Cc: Juergen Borleis

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
---
 commands/mmc_extcsd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/mmc_extcsd.c b/commands/mmc_extcsd.c
index 40d11df17d..7ae068348d 100644
--- a/commands/mmc_extcsd.c
+++ b/commands/mmc_extcsd.c
@@ -2163,7 +2163,7 @@ static int print_field(u8 *reg, int index)
 			str = "FIFO policy for cache";
 		else
 			str = "not provided";
-		printf("\t[0] Device flushing: %s", str);
+		printf("\t[0] Device flushing: %s\n", str);
 		return 1;
 
 	case EXT_CSD_OPTIMAL_READ_SIZE:
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/5] mci: mci-core: fix long lasting FIXMEs
  2020-09-09 11:01 [PATCH 1/5] commands: mmc_extcsd: print_field: fix 32 bit overflow Juergen Borleis
  2020-09-09 11:01 ` [PATCH 2/5] commands: mmc_extcsd: print_field: fix layout Juergen Borleis
@ 2020-09-09 11:01 ` Juergen Borleis
  2020-09-14 14:58   ` Ahmad Fatoum
  2020-09-15  7:52   ` [PATCH v2] " Juergen Borleis
  2020-09-09 11:01 ` [PATCH 4/5] mci: kconfig: explain what boot partitions are Juergen Borleis
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 11+ messages in thread
From: Juergen Borleis @ 2020-09-09 11:01 UTC (permalink / raw)
  To: barebox; +Cc: Juergen Borleis

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
---
 drivers/mci/mci-core.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index a58dedc1cd..d93be6d33f 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -361,9 +361,9 @@ static int mmc_send_op_cond(struct mci *mci)
 }
 
 /**
- * FIXME
- * @param mci MCI instance
- * @param ext_csd Buffer for a 512 byte sized extended CSD
+ * Read-in the card's whole extended CSD configuration area
+ * @param[in] mci MCI instance
+ * @param[out] ext_csd Buffer for an #EXT_CSD_BLOCKSIZE byte sized extended CSD
  * @return Transaction status (0 on success)
  *
  * Note: Only cards newer than Version 1.1 (Physical Layer Spec) support
@@ -379,19 +379,23 @@ int mci_send_ext_csd(struct mci *mci, char *ext_csd)
 
 	data.dest = ext_csd;
 	data.blocks = 1;
-	data.blocksize = 512;
+	data.blocksize = EXT_CSD_BLOCKSIZE;
 	data.flags = MMC_DATA_READ;
 
 	return mci_send_cmd(mci, &cmd, &data);
 }
 
 /**
- * FIXME
- * @param mci MCI instance
- * @param set FIXME
- * @param index FIXME
- * @param value FIXME
+ * Write a byte into the card's extended CSD configuration area
+ * @param[in] mci MCI instance
+ * @param[in] index Byte index in the extended CSD configuration area
+ * @param[in] value Byte to write at index into the extended CSD configuration area
  * @return Transaction status (0 on success)
+ *
+ * This sends a CMD6 (aka SWITCH) to the card and writes @b value at extended CSD @b index.
+ *
+ * @note It always writes a full byte, the alternatives 'bit set' and
+ *      'bit clear' aren't supported.
  */
 int mci_switch(struct mci *mci, unsigned index, unsigned value)
 {
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 4/5] mci: kconfig: explain what boot partitions are
  2020-09-09 11:01 [PATCH 1/5] commands: mmc_extcsd: print_field: fix 32 bit overflow Juergen Borleis
  2020-09-09 11:01 ` [PATCH 2/5] commands: mmc_extcsd: print_field: fix layout Juergen Borleis
  2020-09-09 11:01 ` [PATCH 3/5] mci: mci-core: fix long lasting FIXMEs Juergen Borleis
@ 2020-09-09 11:01 ` Juergen Borleis
  2020-09-09 11:01 ` [PATCH 5/5] mci: mci-core: add GPP support Juergen Borleis
  2020-09-14 10:07 ` [PATCH 1/5] commands: mmc_extcsd: print_field: fix 32 bit overflow Sascha Hauer
  4 siblings, 0 replies; 11+ messages in thread
From: Juergen Borleis @ 2020-09-09 11:01 UTC (permalink / raw)
  To: barebox; +Cc: Juergen Borleis

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
---
 drivers/mci/Kconfig | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mci/Kconfig b/drivers/mci/Kconfig
index f7dc5c5089..996d8ff122 100644
--- a/drivers/mci/Kconfig
+++ b/drivers/mci/Kconfig
@@ -34,6 +34,13 @@ config MCI_WRITE
 
 config MCI_MMC_BOOT_PARTITIONS
 	bool "support MMC boot partitions"
+	help
+	  Provide access to the 'boot partitions' of devices of type 'MMC'.
+	  These so called 'hardware partitions' act like an independent memory
+	  device and thus, need special handling.
+
+	  Note: only 'MMC' have 'boot partitions'. So, if you don't use an
+	  'MMC' device, you don't need this support.
 
 comment "--- MCI host drivers ---"
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 5/5] mci: mci-core: add GPP support
  2020-09-09 11:01 [PATCH 1/5] commands: mmc_extcsd: print_field: fix 32 bit overflow Juergen Borleis
                   ` (2 preceding siblings ...)
  2020-09-09 11:01 ` [PATCH 4/5] mci: kconfig: explain what boot partitions are Juergen Borleis
@ 2020-09-09 11:01 ` Juergen Borleis
  2020-09-14 10:07 ` [PATCH 1/5] commands: mmc_extcsd: print_field: fix 32 bit overflow Sascha Hauer
  4 siblings, 0 replies; 11+ messages in thread
From: Juergen Borleis @ 2020-09-09 11:01 UTC (permalink / raw)
  To: barebox; +Cc: Juergen Borleis

General Purpose Partitions (GPP) are hardware partitions like the boot
partitions. And like the boot partitions they are limited to MMCs only.
Most applications running an eMMC do not use GPPs, so this feature can be
disabled.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
---
 drivers/mci/Kconfig    | 13 ++++++++
 drivers/mci/mci-core.c | 76 ++++++++++++++++++++++++++++++++++++++++--
 include/mci.h          |  1 +
 3 files changed, 88 insertions(+), 2 deletions(-)

diff --git a/drivers/mci/Kconfig b/drivers/mci/Kconfig
index 996d8ff122..4d7f5beb42 100644
--- a/drivers/mci/Kconfig
+++ b/drivers/mci/Kconfig
@@ -42,6 +42,19 @@ config MCI_MMC_BOOT_PARTITIONS
 	  Note: only 'MMC' have 'boot partitions'. So, if you don't use an
 	  'MMC' device, you don't need this support.
 
+config MCI_MMC_GPP_PARTITIONS
+	bool "support MMC general purpose partitions (GPP)"
+	help
+	  Provide access to the 'general purpose partitions' of devices of type
+	  'MMC'. These so called 'hardware partitions' act like an independent
+	  memory device and thus, need special handling.
+
+	  Note: only 'MMC' devices have 'general purpose partitions'. So, if
+	  you don't use an 'MMC' device, you don't need this support.
+
+	  Note: by default, 'MMC' devices have no 'general purpose partitions',
+	  it requires a special one-time configuration step to enable them.
+
 comment "--- MCI host drivers ---"
 
 config MCI_DW
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index d93be6d33f..7d0fe487d8 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -33,6 +33,7 @@
 #include <disks.h>
 #include <of.h>
 #include <linux/err.h>
+#include <linux/sizes.h>
 
 #define MAX_BUFFER_NUMBER 0xffffffff
 
@@ -444,6 +445,69 @@ static void mci_part_add(struct mci *mci, uint64_t size,
 	mci->nr_parts++;
 }
 
+/**
+ * Read a value spread to three consecutive bytes in the ECSD information
+ * @param[in] ecsd_info Information from the eMMC
+ * @param[in] idx The index where to start to read
+ * @return The GPP size in units of 'write protect group' size
+ *
+ * The value in the ECSD information block is meant in little endian
+ */
+static __maybe_unused unsigned mmc_extract_gpp_units(const char *ecsd_info, unsigned idx)
+{
+	unsigned val;
+
+	val = ecsd_info[idx];
+	val |= ecsd_info[idx + 1] << 8;
+	val |= ecsd_info[idx + 2] << 16;
+
+	return val;
+}
+
+/**
+ * Create and enable access to 'general purpose hardware partitions' on demand
+ * @param mci[in,out] MCI instance
+ *
+ * General Purpose hardware Partitions (aka GPPs) aren't enabled by default. Its
+ * up to the application to (one-time) setup the eMMC to provide GPPs. Since
+ * they aren't wildly used, enable access to them on demand only.
+ */
+static __maybe_unused void mmc_extract_gpp_partitions(struct mci *mci)
+{
+	uint64_t wpgs, part_size;
+	size_t idx;
+	char *name, *partname;
+	static const unsigned gpp_offsets[MMC_NUM_GP_PARTITION] = {
+		EXT_CSD_GP_SIZE_MULT0, EXT_CSD_GP_SIZE_MULT1,
+		EXT_CSD_GP_SIZE_MULT2, EXT_CSD_GP_SIZE_MULT3, };
+
+	if (!(mci->ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & 0x01))
+		return; /* no partitioning support */
+	/*
+	 * The size of GPPs is defined in units of 'write protect group' size.
+	 * The 'write protect group' size is defined to:
+	 *  CSD_HC_ERASE_GRP_SIZE * CSD_HC_WP_GRP_SIZE * 512 kiB
+	 */
+	wpgs = mci->ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE];
+	wpgs *= mci->ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
+	wpgs *= SZ_512K;
+
+	/* up to four GPPs can be enabled. */
+	for (idx = 0; idx < ARRAY_SIZE(gpp_offsets); idx++) {
+		part_size = mmc_extract_gpp_units(mci->ext_csd, gpp_offsets[idx]);
+		if (part_size == 0)
+			continue;
+		/* Convert to bytes */
+		part_size *= wpgs;
+
+		partname = basprintf("gpp%d", idx);
+		name = basprintf("%s.%s", mci->cdevname, partname);
+		/* TODO read-only flag */
+		mci_part_add(mci, part_size, EXT_CSD_PART_CONFIG_ACC_GPP0 + idx,
+			     name, partname, idx, false, MMC_BLK_DATA_AREA_GP);
+	}
+}
+
 /**
  * Change transfer frequency for an MMC card
  * @param mci MCI instance
@@ -519,6 +583,9 @@ static int mmc_change_freq(struct mci *mci)
 		mci->bootpart = (mci->ext_csd_part_config >> 3) & 0x7;
 	}
 
+	if (IS_ENABLED(CONFIG_MCI_MMC_GPP_PARTITIONS))
+		mmc_extract_gpp_partitions(mci);
+
 	return 0;
 }
 
@@ -1243,13 +1310,16 @@ static int sd_send_if_cond(struct mci *mci)
 	return 0;
 }
 
+/**
+ * Switch between hardware MMC partitions on demand
+ */
 static int mci_blk_part_switch(struct mci_part *part)
 {
 	struct mci *mci = part->mci;
 	int ret;
 
-	if (!IS_ENABLED(CONFIG_MCI_MMC_BOOT_PARTITIONS))
-		return 0;
+	if (!IS_ENABLED(CONFIG_MCI_MMC_BOOT_PARTITIONS) && !IS_ENABLED(CONFIG_MCI_MMC_GPP_PARTITIONS))
+		return 0; /* no need */
 
 	if (mci->part_curr == part)
 		return 0;
@@ -1641,6 +1711,8 @@ static int mci_register_partition(struct mci_part *part)
 		break;
 	case MMC_BLK_DATA_AREA_MAIN:
 		break;
+	case MMC_BLK_DATA_AREA_GP:
+		break;
 	default:
 		return 0;
 	}
diff --git a/include/mci.h b/include/mci.h
index 96547fb396..b63435872b 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -277,6 +277,7 @@
  */
 #define EXT_CSD_PART_CONFIG_ACC_MASK	(0x7)
 #define EXT_CSD_PART_CONFIG_ACC_BOOT0	(0x1)
+#define EXT_CSD_PART_CONFIG_ACC_GPP0	(0x4)
 
 #define EXT_CSD_CMD_SET_NORMAL		(1<<0)
 #define EXT_CSD_CMD_SET_SECURE		(1<<1)
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/5] commands: mmc_extcsd: print_field: fix 32 bit overflow
  2020-09-09 11:01 [PATCH 1/5] commands: mmc_extcsd: print_field: fix 32 bit overflow Juergen Borleis
                   ` (3 preceding siblings ...)
  2020-09-09 11:01 ` [PATCH 5/5] mci: mci-core: add GPP support Juergen Borleis
@ 2020-09-14 10:07 ` Sascha Hauer
  4 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2020-09-14 10:07 UTC (permalink / raw)
  To: Juergen Borleis; +Cc: barebox

On Wed, Sep 09, 2020 at 01:01:14PM +0200, Juergen Borleis wrote:
> Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
> ---
>  commands/mmc_extcsd.c | 23 +++++++++++++++--------
>  1 file changed, 15 insertions(+), 8 deletions(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/5] mci: mci-core: fix long lasting FIXMEs
  2020-09-09 11:01 ` [PATCH 3/5] mci: mci-core: fix long lasting FIXMEs Juergen Borleis
@ 2020-09-14 14:58   ` Ahmad Fatoum
  2020-09-14 18:02     ` Sascha Hauer
  2020-09-15  7:45     ` Juergen Borleis
  2020-09-15  7:52   ` [PATCH v2] " Juergen Borleis
  1 sibling, 2 replies; 11+ messages in thread
From: Ahmad Fatoum @ 2020-09-14 14:58 UTC (permalink / raw)
  To: Juergen Borleis, barebox, Sascha Hauer

Hello Juergen,

On 9/9/20 1:01 PM, Juergen Borleis wrote:
> Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
> ---
>  drivers/mci/mci-core.c | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index a58dedc1cd..d93be6d33f 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -361,9 +361,9 @@ static int mmc_send_op_cond(struct mci *mci)
>  }
>  
>  /**
> - * FIXME
> - * @param mci MCI instance
> - * @param ext_csd Buffer for a 512 byte sized extended CSD
> + * Read-in the card's whole extended CSD configuration area
> + * @param[in] mci MCI instance
> + * @param[out] ext_csd Buffer for an #EXT_CSD_BLOCKSIZE byte sized extended CSD
>   * @return Transaction status (0 on success)
>   *
>   * Note: Only cards newer than Version 1.1 (Physical Layer Spec) support
> @@ -379,19 +379,23 @@ int mci_send_ext_csd(struct mci *mci, char *ext_csd)
>  
>  	data.dest = ext_csd;
>  	data.blocks = 1;
> -	data.blocksize = 512;
> +	data.blocksize = EXT_CSD_BLOCKSIZE;

This breaks the build; EXT_CSD_BLOCKSIZE is undeclared in mci-core.c.
Did you forget a prerequisite patch?

>  	data.flags = MMC_DATA_READ;
>  
>  	return mci_send_cmd(mci, &cmd, &data);
>  }
>  
>  /**
> - * FIXME
> - * @param mci MCI instance
> - * @param set FIXME
> - * @param index FIXME
> - * @param value FIXME
> + * Write a byte into the card's extended CSD configuration area
> + * @param[in] mci MCI instance
> + * @param[in] index Byte index in the extended CSD configuration area
> + * @param[in] value Byte to write at index into the extended CSD configuration area
>   * @return Transaction status (0 on success)
> + *
> + * This sends a CMD6 (aka SWITCH) to the card and writes @b value at extended CSD @b index.
> + *
> + * @note It always writes a full byte, the alternatives 'bit set' and
> + *      'bit clear' aren't supported.
>   */
>  int mci_switch(struct mci *mci, unsigned index, unsigned value)
>  {
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/5] mci: mci-core: fix long lasting FIXMEs
  2020-09-14 14:58   ` Ahmad Fatoum
@ 2020-09-14 18:02     ` Sascha Hauer
  2020-09-15  7:45     ` Juergen Borleis
  1 sibling, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2020-09-14 18:02 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, Juergen Borleis

On Mon, Sep 14, 2020 at 04:58:01PM +0200, Ahmad Fatoum wrote:
> Hello Juergen,
> 
> On 9/9/20 1:01 PM, Juergen Borleis wrote:
> > Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
> > ---
> >  drivers/mci/mci-core.c | 22 +++++++++++++---------
> >  1 file changed, 13 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> > index a58dedc1cd..d93be6d33f 100644
> > --- a/drivers/mci/mci-core.c
> > +++ b/drivers/mci/mci-core.c
> > @@ -361,9 +361,9 @@ static int mmc_send_op_cond(struct mci *mci)
> >  }
> >  
> >  /**
> > - * FIXME
> > - * @param mci MCI instance
> > - * @param ext_csd Buffer for a 512 byte sized extended CSD
> > + * Read-in the card's whole extended CSD configuration area
> > + * @param[in] mci MCI instance
> > + * @param[out] ext_csd Buffer for an #EXT_CSD_BLOCKSIZE byte sized extended CSD
> >   * @return Transaction status (0 on success)
> >   *
> >   * Note: Only cards newer than Version 1.1 (Physical Layer Spec) support
> > @@ -379,19 +379,23 @@ int mci_send_ext_csd(struct mci *mci, char *ext_csd)
> >  
> >  	data.dest = ext_csd;
> >  	data.blocks = 1;
> > -	data.blocksize = 512;
> > +	data.blocksize = EXT_CSD_BLOCKSIZE;
> 
> This breaks the build; EXT_CSD_BLOCKSIZE is undeclared in mci-core.c.
> Did you forget a prerequisite patch?

Dropped the patch for now.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/5] mci: mci-core: fix long lasting FIXMEs
  2020-09-14 14:58   ` Ahmad Fatoum
  2020-09-14 18:02     ` Sascha Hauer
@ 2020-09-15  7:45     ` Juergen Borleis
  1 sibling, 0 replies; 11+ messages in thread
From: Juergen Borleis @ 2020-09-15  7:45 UTC (permalink / raw)
  To: Ahmad Fatoum, barebox, Sascha Hauer

Hi Ahmad,

Am Montag, den 14.09.2020, 16:58 +0200 schrieb Ahmad Fatoum:
> […]
> > @@ -379,19 +379,23 @@ int mci_send_ext_csd(struct mci *mci, char *ext_csd)
> >  
> >  	data.dest = ext_csd;
> >  	data.blocks = 1;
> > -	data.blocksize = 512;
> > +	data.blocksize = EXT_CSD_BLOCKSIZE;
> 
> This breaks the build; EXT_CSD_BLOCKSIZE is undeclared in mci-core.c.
> Did you forget a prerequisite patch?

Branch confusion in my repo... I will send a different branch without this
special change.

Thanks
Juergen

-- 
Pengutronix e.K.                       | Juergen Borleis             |
Steuerwalder Str. 21                   | https://www.pengutronix.de/ |
31137 Hildesheim, Germany              | Phone: +49-5121-206917-128  |
Amtsgericht Hildesheim, HRA 2686       | Fax:   +49-5121-206917-9    |


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2] mci: mci-core: fix long lasting FIXMEs
  2020-09-09 11:01 ` [PATCH 3/5] mci: mci-core: fix long lasting FIXMEs Juergen Borleis
  2020-09-14 14:58   ` Ahmad Fatoum
@ 2020-09-15  7:52   ` Juergen Borleis
  2020-09-15 12:36     ` Sascha Hauer
  1 sibling, 1 reply; 11+ messages in thread
From: Juergen Borleis @ 2020-09-15  7:52 UTC (permalink / raw)
  To: barebox; +Cc: Juergen Borleis

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
---
 drivers/mci/mci-core.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 21eff2f593..8d29ca6401 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -362,9 +362,9 @@ static int mmc_send_op_cond(struct mci *mci)
 }
 
 /**
- * FIXME
- * @param mci MCI instance
- * @param ext_csd Buffer for a 512 byte sized extended CSD
+ * Read-in the card's whole extended CSD configuration area
+ * @param[in] mci MCI instance
+ * @param[out] ext_csd Buffer for an #EXT_CSD_BLOCKSIZE byte sized extended CSD
  * @return Transaction status (0 on success)
  *
  * Note: Only cards newer than Version 1.1 (Physical Layer Spec) support
@@ -387,12 +387,16 @@ int mci_send_ext_csd(struct mci *mci, char *ext_csd)
 }
 
 /**
- * FIXME
- * @param mci MCI instance
- * @param set FIXME
- * @param index FIXME
- * @param value FIXME
+ * Write a byte into the card's extended CSD configuration area
+ * @param[in] mci MCI instance
+ * @param[in] index Byte index in the extended CSD configuration area
+ * @param[in] value Byte to write at index into the extended CSD configuration area
  * @return Transaction status (0 on success)
+ *
+ * This sends a CMD6 (aka SWITCH) to the card and writes @b value at extended CSD @b index.
+ *
+ * @note It always writes a full byte, the alternatives 'bit set' and
+ *      'bit clear' aren't supported.
  */
 int mci_switch(struct mci *mci, unsigned index, unsigned value)
 {
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] mci: mci-core: fix long lasting FIXMEs
  2020-09-15  7:52   ` [PATCH v2] " Juergen Borleis
@ 2020-09-15 12:36     ` Sascha Hauer
  0 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2020-09-15 12:36 UTC (permalink / raw)
  To: Juergen Borleis; +Cc: barebox

On Tue, Sep 15, 2020 at 09:52:50AM +0200, Juergen Borleis wrote:
> Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
> ---
>  drivers/mci/mci-core.c | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-09-15 12:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 11:01 [PATCH 1/5] commands: mmc_extcsd: print_field: fix 32 bit overflow Juergen Borleis
2020-09-09 11:01 ` [PATCH 2/5] commands: mmc_extcsd: print_field: fix layout Juergen Borleis
2020-09-09 11:01 ` [PATCH 3/5] mci: mci-core: fix long lasting FIXMEs Juergen Borleis
2020-09-14 14:58   ` Ahmad Fatoum
2020-09-14 18:02     ` Sascha Hauer
2020-09-15  7:45     ` Juergen Borleis
2020-09-15  7:52   ` [PATCH v2] " Juergen Borleis
2020-09-15 12:36     ` Sascha Hauer
2020-09-09 11:01 ` [PATCH 4/5] mci: kconfig: explain what boot partitions are Juergen Borleis
2020-09-09 11:01 ` [PATCH 5/5] mci: mci-core: add GPP support Juergen Borleis
2020-09-14 10:07 ` [PATCH 1/5] commands: mmc_extcsd: print_field: fix 32 bit overflow Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox