MCI: support boot partitions
Subsystems (2)
PATCH 1/1 MCI: support boot partitions
(newer?) eMMCs have some areas intended for bootloaders. This series adds support for them. i.MX SoCs support booting from these areas which is quite convenient since we no longer have to take care about the regular partition table.
Also this series adds a new device parameter convenience helper for enums.
Sascha
----------------------------------------------------------------
Sascha Hauer (3):
param: Add info function
param: Add helpers to provide an enum parameter
mci: Add support for MMC boot partitions
drivers/base/driver.c | 8 ++- drivers/mci/Kconfig | 3 + drivers/mci/mci-core.c | 192 ++++++++++++++++++++++++++++++++++++++----------- include/mci.h | 31 +++++++- include/param.h | 15 ++++ lib/parameter.c | 104 +++++++++++++++++++++++++++ 6 files changed, 308 insertions(+), 45 deletions(-)
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/3 param: Add helpers to provide an enum parameter
We recently gained helper functions for different types of device parameters. One thing missing was a helper for an enum type parameter. This patch adds this.
--- include/param.h | 14 ++++++++ lib/parameter.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+)
include/param.h +14 -0
@@ -41,6 +41,11 @@ struct param_d *dev_add_param_bool(struct device_d *dev, const char *name,int (*get)(struct param_d *p,void *priv), int *value, void *priv); +struct param_d *dev_add_param_enum (struct device_d *dev,const char *name, +int (*set)(struct param_d *p,void *priv), +int (*get)(struct param_d *p,void *priv), +int *value,const char **names,int max,void *priv); +struct param_d *dev_add_param_int_ro (struct device_d *dev,const char *name,int value,const char *format);
@@ -90,6 +95,15 @@ static inline struct param_d *dev_add_param_int(struct device_d *dev, const charreturn NULL ; } +static inline struct param_d *dev_add_param_enum (struct device_d *dev,const char *name, +int (*set)(struct param_d *p,void *priv), +int (*get)(struct param_d *p,void *priv), +int *value,const char **names,int max,void *priv) + +{ +return NULL ; +} + static inline struct param_d *dev_add_param_bool(struct device_d *dev, const char *name, int (*set)(struct param_d *p, void *priv), int (*get)(struct param_d *p, void *priv),
lib/parameter.c +104 -0
110 lines not on this page · raw message
Signature · 7 lines
1.8.2.rc2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/3 param: Add info function
In reply to Sascha HauerSome parameters may wish to provide some information about their meaning or possible values. Provide an info callback for parameters.
--- drivers/base/driver.c | 8 ++++++-- include/param.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/base/driver.c +6 -2
@@ -495,8 +495,12 @@ static int do_devinfo(int argc, char *argv[])printf ("%s\n" ,list_empty (&dev->parameters) ?"no parameters available" :"Parameters:" ); -list_for_each_entry (param, &dev->parameters, list) -printf ("%16s = %s\n" , param->name,dev_get_param (dev, param->name)); +list_for_each_entry (param, &dev->parameters, list) { +printf ("%16s = %s" , param->name,dev_get_param (dev, param->name)); +if (param->info) + param->info (param); +printf ("\n" ); + }#ifdef CONFIG_OFDEVICE if (dev->device_node) {printf ("\ndevice node: %s\n" , dev->device_node->full_name);
include/param.h +1 -0
@@ -12,6 +12,7 @@ typedef unsigned long IPaddr_t;struct param_d {const char * (*get)(struct device_d *,struct param_d *param);int (*set)(struct device_d *,struct param_d *param,const char *val); +void (*info)(struct param_d *param);unsigned int flags;char *name;char *value;
Signature · 7 lines
1.8.2.rc2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/3 mci: Add support for MMC boot partitions
In reply to Sascha HauerSome MMC cards support boot partitions. These are special regions on the MMC card intended to put a bootloader on.
This patch adds support for these partitions, they are accessible as /dev/diskx.boot[0|1].
Additionally the partitions can be configured bootable using a device parameter. This can be used to mark the user area or one of the boot partitions as bootable.
Since this feature is mostly seen on eMMC cards it is made optional to lower the size impact for boards which do not have eMMC.
--- drivers/mci/Kconfig | 3 + drivers/mci/mci-core.c | 192 ++++++++++++++++++++++++++++++++++++++----------- include/mci.h | 31 +++++++- 3 files changed, 183 insertions(+), 43 deletions(-)
drivers/mci/Kconfig +3 -0
@@ -29,6 +29,9 @@ config MCI_WRITE default y select DISK_WRITE +config MCI_MMC_BOOT_PARTITIONS + bool "support MMC boot partitions" + comment "--- MCI host drivers ---" config MCI_MXS
drivers/mci/mci-core.c +150 -42
266 lines not on this page · raw message
include/mci.h +30 -1
@@ -185,6 +185,8 @@/* * EXT_CSD field definitions */ +#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7) +#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1)#define EXT_CSD_CMD_SET_NORMAL (1<<0)#define EXT_CSD_CMD_SET_SECURE (1<<1)
@@ -306,10 +308,28 @@ struct mci_host {int (*card_write_protected)(struct mci_host *); }; +struct mci ; + +#define MMC_NUM_BOOT_PARTITION 2 +#define MMC_NUM_GP_PARTITION 4 +#define MMC_NUM_PHY_PARTITION 6 + +struct mci_part { +struct block_device blk;/**< the blockdevice for the card */ +struct mci *mci; +uint64_t size;/* partition size (in bytes) */ +unsigned int part_cfg;/* partition type */ +char *name; +unsigned int area_type; +#define MMC_BLK_DATA_AREA_MAIN (1<<0) +#define MMC_BLK_DATA_AREA_BOOT (1<<1) +#define MMC_BLK_DATA_AREA_GP (1<<2) +#define MMC_BLK_DATA_AREA_RPMB (1<<3) +}; +/** MMC/SD and interface instance information */ struct mci {struct mci_host *host;/**< the host for this card */ -struct block_device blk;/**< the blockdevice for the card */ struct device_d *mci_dev;/**< the device for our disk (mcix) */ unsigned version;/** != 0 when a high capacity card is connected (OCR -> OCR_HCS) */
@@ -330,6 +350,15 @@ struct mci {char *ext_csd;int probe;struct param_d *param_probe; +struct param_d *param_boot; +int bootpart; + +struct mci_part part[MMC_NUM_PHY_PARTITION ]; +int nr_parts; +char *cdevname; + +struct mci_part *part_curr; +u8 ext_csd_part_config; };int mci_register (struct mci_host *);
Signature · 7 lines
1.8.2.rc2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox