RE: [PATCH 1/2] mmc-utils: Support MANUAL_EN and AUTO_EN in BKOPS_EN register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> 
> From: Lars Pedersen <lapeddk@xxxxxxxxx>
Please sign your patch (use -s when running git commit)

> 
> The BKOPS_EN register in eMMC 5.1 now has two fields AUTO_EN and
> MANUAL_EN.
It was already in 5.0


> +       { do_write_bkops_auto_en, -2,
> +         "bkops auto", "<mode> <device>\n"
> +               "Enable/disable eMMC BKOPS AUTO_EN feature on <device>.\nThe
> device may perform background operations while not servicing the host.\n"
> +               "NOTE!  Only supported in eMMC-5.1 and
> + MANUAL_EN(BKOPS_EN[0]) must not be set",
>           NULL
Although there is not much sense of setting those both,
I am not sure that the manual and auto bits are mutually exclusive.
Will ask around.

>         },
>         { do_hwreset_en, -1,
> @@ -467,7 +473,7 @@ static int parse_args(int argc, char **argv,
>                         matchcmd->verb, matchcmd->nargs);
>                         return -2;
>         }
> -
> +
Not belong to this patch

> +int do_write_bkops_auto_en(int nargs, char **argv) {
> +       __u8 ext_csd[512], value = 0;
> +       int fd, ret;
> +       char *device;
> +       char *mode;
> +
> +       if (nargs != 3) {
> +              fprintf(stderr, "Usage: mmc bkops auto enable/disable
> </path/to/mmcblkX>\n");
> +              exit(1);
> +       }
> +
> +       mode = argv[1];
> +       device = argv[2];
> +
> +       fd = open(device, O_RDWR);
> +       if (fd < 0) {
> +               perror("open");
> +               exit(1);
> +       }
> +
> +       ret = read_extcsd(fd, ext_csd);
> +       if (ret) {
> +               fprintf(stderr, "Could not read EXT_CSD from %s\n", device);
> +               exit(1);
> +       }
> +
> +       if (ext_csd[EXT_CSD_REV] != EXT_CSD_REV_V5_1) {
ext_csd[EXT_CSD_REV] < EXT_CSD_REV_V5_0

> +               fprintf(stderr, "%s doesn't support eMMC 5.1\n", device);
> +               exit(1);
> +       }
> +
> +       if (!(ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1)) {
This is obsolete in 5.1 and need not be checked.

> +               fprintf(stderr, "%s doesn't support BKOPS\n", device);
> +               exit(1);
> +       }
> +
> +       if ((ext_csd[EXT_CSD_BKOPS_EN] & 0x1)) {
Again - not sure about that.
Look in the kerne's driver, its checks for both options.

> +               fprintf(stderr, "%s manual BKOPS already enabled.\n", device);
> +               exit(1);
> +       }
> +
> +       if (strcmp(mode, "enable") == 0) {
> +               ret = write_extcsd_value(fd, EXT_CSD_BKOPS_EN,
> BKOPS_ENABLE_AUTO_SET);
> +       } else if (strcmp(mode, "disable") == 0) {
> +               ret = write_extcsd_value(fd, EXT_CSD_BKOPS_EN,
> BKOPS_ENABLE_AUTO_CLR);
> +       } else {
> +               fprintf(stderr, "%s invalid mode for BKOPS_EN AUTO_EN requested:
> %s. Valid options: enable or disable\n", mode, device);
> +               exit(1);
> +       }
> +

I even think, as we are not so strictly obliged to zero API changes,
Maybe just change the api to do_write_bkops_en(), and simply allow to set 1, 2, or 3 to that register?


Thanks,
Avri




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux