Skip to contentSkip to conversation

ANNOUNCE: new "mmc-utils" repository

DISCUSSION Chris Ball 5 participants 16 messages Feb 12, 2012 – Feb 20, 2012 MMC, SD and SDIO

lore
Share & tools
lore

Chris Ball

author
#0 lore raw

Hi,

I've created a repository for userspace mmc tools now:

git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git

At the moment the only commands supported are Johan Rudholm's extcsd write-protect commands, exposed as:

./mmc extcsd read /dev/mmcblkX
./mmc extcsd write /dev/mmcblkX

Johan, when I try running these I'm seeing:

octavius:cjb~/git/mmc-utils % sudo ./mmc extcsd read /dev/mmcblk0 sdhci-pci 0000:0d:00.0: mmc_blk_ioctl_cmd: cmd error -110
ioctl: Connection timed out
Could not read EXT_CSD from /dev/mmcblk0

Were you doing something to get the card back into idle state first, perhaps?

Giuseppe, it would be excellent if you could add your ext_csd parsing code to the "extcsd read" command.

Shashidhar, please could you separate out the kernel-side changes needed for your test ioctl, and send a patch for kernelspace and one to add an "mmc runcmd <cmd>" command to this tool?

Thanks everyone! If anyone else has userspace mmc code to contribute, feel free to hook it up to this tool and send patches to linux-mmc@.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#1 lore raw
Quoted 2 lines · Chris Ball

I've created a repository for userspace mmc tools now:
git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git

Way to go Chris, this is great stuff!

Yours,
Linus Walleij

#2 lore raw
In reply to Chris Ball
Quoted 12 lines · Chris Ball

Hi,

I've created a repository for userspace mmc tools now:

git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git

At the moment the only commands supported are Johan Rudholm's extcsd write-protect commands, exposed as:

./mmc extcsd read /dev/mmcblkX
./mmc extcsd write /dev/mmcblkX

Quoted 6 lines

Johan, when I try running these I'm seeing:

octavius:cjb~/git/mmc-utils % sudo ./mmc extcsd read /dev/mmcblk0 sdhci-pci 0000:0d:00.0: mmc_blk_ioctl_cmd: cmd error -110
ioctl: Connection timed out
Could not read EXT_CSD from /dev/mmcblk0

I tested with SD and eMMC.
In eMMC case..

/opt/home/root # mmc extcsd read /dev/mmcblk0
Power ro locking: possible
Permanent ro locking: possible
ro lock status: not locked

But In SD card,
s3c-sdhci s3c-sdhci.2: mmc_blk_ioctl_cmd: cmd error -110
ioctl: Connection timed out
Could not read EXT_CSD from /dev/mmcblk1

What differ? Anyway..It's great about mmc-utils.

Best Regards,
Jaehoon Chung

Quoted 15 lines

Were you doing something to get the card back into idle state first, perhaps?

Giuseppe, it would be excellent if you could add your ext_csd parsing code to the "extcsd read" command.

Shashidhar, please could you separate out the kernel-side changes needed for your test ioctl, and send a patch for kernelspace and one to add an "mmc runcmd <cmd>" command to this tool?

Thanks everyone! If anyone else has userspace mmc code to contribute, feel free to hook it up to this tool and send patches to linux-mmc@.

- Chris.

#3 lore raw
Quoted 29 lines · Jaehoon Chung
Quoted 12 lines · Chris Ball

Hi,

I've created a repository for userspace mmc tools now:

git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git

At the moment the only commands supported are Johan Rudholm's extcsd write-protect commands, exposed as:

./mmc extcsd read /dev/mmcblkX
./mmc extcsd write /dev/mmcblkX

Quoted 6 lines

Johan, when I try running these I'm seeing:

octavius:cjb~/git/mmc-utils % sudo ./mmc extcsd read /dev/mmcblk0 sdhci-pci 0000:0d:00.0: mmc_blk_ioctl_cmd: cmd error -110
ioctl: Connection timed out
Could not read EXT_CSD from /dev/mmcblk0

I tested with SD and eMMC.
In eMMC case..

/opt/home/root # mmc extcsd read /dev/mmcblk0
Power ro locking: possible
Permanent ro locking: possible
ro lock status: not locked

Quoted 6 lines

But In SD card,
s3c-sdhci s3c-sdhci.2: mmc_blk_ioctl_cmd: cmd error -110
ioctl: Connection timed out
Could not read EXT_CSD from /dev/mmcblk1

What differ? Anyway..It's great about mmc-utils.

Yes, this is expected -- SD cards don't have the ext csd register.

Kind regards, Johan

#4 lore raw
Quoted 31 lines · Johan RUDHOLM
Quoted 29 lines · Jaehoon Chung
Quoted 12 lines · Chris Ball

Hi,

I've created a repository for userspace mmc tools now:

git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git

At the moment the only commands supported are Johan Rudholm's extcsd write-protect commands, exposed as:

./mmc extcsd read /dev/mmcblkX
./mmc extcsd write /dev/mmcblkX

Quoted 6 lines

Johan, when I try running these I'm seeing:

octavius:cjb~/git/mmc-utils % sudo ./mmc extcsd read /dev/mmcblk0 sdhci-pci 0000:0d:00.0: mmc_blk_ioctl_cmd: cmd error -110
ioctl: Connection timed out
Could not read EXT_CSD from /dev/mmcblk0

I tested with SD and eMMC.
In eMMC case..

/opt/home/root # mmc extcsd read /dev/mmcblk0
Power ro locking: possible
Permanent ro locking: possible
ro lock status: not locked

Quoted 8 lines
Quoted 6 lines

But In SD card,
s3c-sdhci s3c-sdhci.2: mmc_blk_ioctl_cmd: cmd error -110
ioctl: Connection timed out
Could not read EXT_CSD from /dev/mmcblk1

What differ? Anyway..It's great about mmc-utils.

Yes, this is expected -- SD cards don't have the ext csd register.

What kernel version is supported? up to linux-3.3? did you know? Best Regards,
Jaehoon Chung

Quoted 7 lines

Kind regards, Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#5 lore raw

Hi,

Quoted 1 line · Jaehoon Chung

What kernel version is supported? up to linux-3.3? did you know?

I think the only requirement is the command submission ioctl, so it should work in every kernel from 3.0 onwards.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#6 lore raw

Hi Chris, Jaehoon,

Quoted 8 lines · Chris Ball

Hi,

Quoted 1 line · Jaehoon Chung

What kernel version is supported? up to linux-3.3? did you know?

I think the only requirement is the command submission ioctl, so it should work in every kernel from 3.0 onwards.

Actually, to be able to write to the ext csd via the ioctl, "mmc: core: check for zero length ioctl data" is also required. I think this went into 3.3-rc1.

Kind regards, Johan

#7 lore raw
Quoted 7 lines · Johan RUDHOLM

Hi Chris, Jaehoon,

Quoted 3 lines · Chris Ball

Hi,

Quoted 7 lines
Quoted 5 lines · Jaehoon Chung
Quoted 1 line

What kernel version is supported? up to linux-3.3? did you know?

I think the only requirement is the command submission ioctl, so it should work in every kernel from 3.0 onwards.

Actually, to be able to write to the ext csd via the ioctl, "mmc: core: check for zero length ioctl data" is also required. I think this went into 3.3-rc1.

Hi..Chris, Johan.

I think that mmc extcsd read/write <device> is something wrong..
If mmc extcsd write /dev/mmcblk0, then boot area1/2 is power-on-write-protect. right? And i ran mmc extcsd read /dev/mmcblk0, and i printed the ext_csd[174](BOOT_WP_STATUS) That's always 0x0.

That means Boot-area1/2 is not protected.
In do_write_extcsd(), i think that check with BOOT_WP_STATUS[174] whether protected or not. not BOOT_WP[173].

How think about?

I will send the patch for this.

Best Regards,
Jaehoon Chung

Quoted 7 lines

Kind regards, Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

Hi Jaehoon,

Quoted 28 lines · Jaehoon Chung
Quoted 7 lines · Johan RUDHOLM

Hi Chris, Jaehoon,

Quoted 3 lines · Chris Ball

Hi,

Quoted 7 lines
Quoted 5 lines · Jaehoon Chung
Quoted 1 line

What kernel version is supported? up to linux-3.3? did you know?

I think the only requirement is the command submission ioctl, so it should work in every kernel from 3.0 onwards.

Actually, to be able to write to the ext csd via the ioctl, "mmc:

core: check for zero length ioctl data" is also required. I think this went into 3.3-rc1.

Hi..Chris, Johan.

I think that mmc extcsd read/write <device> is something wrong.. If mmc extcsd write /dev/mmcblk0, then boot area1/2 is power-on-write- protect. right?
And i ran mmc extcsd read /dev/mmcblk0, and i printed the ext_csd[174](BOOT_WP_STATUS)
That's always 0x0.

Quoted 6 lines

That means Boot-area1/2 is not protected.
In do_write_extcsd(), i think that check with BOOT_WP_STATUS[174] whether protected or not.
not BOOT_WP[173].

How think about?

I'm not sure... BOOT_WP_STATUS[174] was added in version 4.5, in 4.41 we only have BOOT_WP[173]. I guess we should read 174 if we have a 4.5 card, from the 4.5 spec: "To verify boot region protection read BOOT_WP_STATUS[174].", I guess this has been added because it's possible to lock only one boot partition in 4.5?

The command works fine for my 4.41 card:

# /data/mmc extcsd read /dev/block/mmcblk0
Power ro locking: possible
Permanent ro locking: possible
ro lock status: not locked
# /data/mmc extcsd write /dev/block/mmcblk0
# /data/mmc extcsd read /dev/block/mmcblk0
Power ro locking: possible
Permanent ro locking: possible
ro lock status: locked until next power on

Kind regards, Johan

author
#9 lore raw
In reply to Johan RUDHOLM

Hi,

Quoted 3 lines · Johan RUDHOLM

Actually, to be able to write to the ext csd via the ioctl, "mmc:
core: check for zero length ioctl data" is also required. I think this went into 3.3-rc1.

I'm seeing a crash when trying to write to the ext_csd on 3.0, so it sounds like we should send this fix to stable@ -- I'll do that shortly.

Thanks,

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#10 lore raw
In reply to Chris Ball
Quoted 9 lines · Chris Ball

Johan, when I try running these I'm seeing:

octavius:cjb~/git/mmc-utils % sudo ./mmc extcsd read /dev/mmcblk0 sdhci-pci 0000:0d:00.0: mmc_blk_ioctl_cmd: cmd error -110
ioctl: Connection timed out
Could not read EXT_CSD from /dev/mmcblk0

Were you doing something to get the card back into idle state first, perhaps?

Thank you for giving the code a home!

Hmm... No, this works fine for me without doing anything special. Even when reading/writing from/to the card, it works fine. It is an eMMC, right?

Kind regards, Johan

author
#11 lore raw

Hi,

Quoted 5 lines · Johan RUDHOLM

Thank you for giving the code a home!

Hmm... No, this works fine for me without doing anything special. Even when reading/writing from/to the card, it works fine. It is an eMMC, right?

Ah, great! I was testing with an SD because I didn't have an eMMC nearby, thinking I'd be able to at least check the CSD transfer. Thanks, all makes sense.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#12 lore raw
In reply to Chris Ball

Hi Chris

Quoted 11 lines · Chris Ball

Hi,

I've created a repository for userspace mmc tools now:

git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git

At the moment the only commands supported are Johan Rudholm's extcsd write-protect commands, exposed as:

./mmc extcsd read /dev/mmcblkX
./mmc extcsd write /dev/mmcblkX

Is it worth now trying to add the logic behind the patch (mmc: debugfs:
parse ext_csd via debug_fs (v2)) I sent time ago to parse the EXT_CSD? I can do that on mmc-utils if not yet done. Pls let me know.

Peppe

Quoted 22 lines

Johan, when I try running these I'm seeing:

octavius:cjb~/git/mmc-utils % sudo ./mmc extcsd read /dev/mmcblk0 sdhci-pci 0000:0d:00.0: mmc_blk_ioctl_cmd: cmd error -110
ioctl: Connection timed out
Could not read EXT_CSD from /dev/mmcblk0

Were you doing something to get the card back into idle state first, perhaps?

Giuseppe, it would be excellent if you could add your ext_csd parsing code to the "extcsd read" command.

Shashidhar, please could you separate out the kernel-side changes needed for your test ioctl, and send a patch for kernelspace and one to add an "mmc runcmd <cmd>" command to this tool?

Thanks everyone! If anyone else has userspace mmc code to contribute, feel free to hook it up to this tool and send patches to linux-mmc@.

- Chris.

author
#13 lore raw

Hi,

Quoted 12 lines · Giuseppe CAVALLARO

Hi Chris

Quoted 9 lines · Chris Ball

Hi,

I've created a repository for userspace mmc tools now:

git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git

At the moment the only commands supported are Johan Rudholm's extcsd write-protect commands, exposed as:

Quoted 7 lines
Quoted 2 lines

./mmc extcsd read /dev/mmcblkX
./mmc extcsd write /dev/mmcblkX

Is it worth now trying to add the logic behind the patch (mmc: debugfs:
parse ext_csd via debug_fs (v2)) I sent time ago to parse the EXT_CSD? I can do that on mmc-utils if not yet done. Pls let me know.

Yes, please. (If you look farther down in the same message I did mention adding it!)

I think you can add it all to mmc extcsd read, rather than introducing a new command.

Thanks,

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#14 lore raw
Quoted 23 lines · Chris Ball

Hi,

Quoted 12 lines · Giuseppe CAVALLARO

Hi Chris

Quoted 9 lines · Chris Ball

Hi,

I've created a repository for userspace mmc tools now:

git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git

At the moment the only commands supported are Johan Rudholm's extcsd write-protect commands, exposed as:

Quoted 7 lines
Quoted 2 lines

./mmc extcsd read /dev/mmcblkX
./mmc extcsd write /dev/mmcblkX

Is it worth now trying to add the logic behind the patch (mmc: debugfs:
parse ext_csd via debug_fs (v2)) I sent time ago to parse the EXT_CSD? I can do that on mmc-utils if not yet done. Pls let me know.

Quoted 5 lines

Yes, please. (If you look farther down in the same message I did mention adding it!)

I think you can add it all to mmc extcsd read, rather than introducing a new command.

Agree! I'll do that and provide a patch asap.

peppe

Quoted 4 lines

Thanks,

- Chris.

#15 lore raw
Quoted 24 lines · Giuseppe CAVALLARO
Quoted 23 lines · Chris Ball

Hi,

Quoted 19 lines · Giuseppe CAVALLARO

Hi Chris

Quoted 11 lines · Chris Ball

Hi,

I've created a repository for userspace mmc tools now:

git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git

At the moment the only commands supported are Johan Rudholm's extcsd write-protect commands, exposed as:

./mmc extcsd read /dev/mmcblkX
./mmc extcsd write /dev/mmcblkX

Is it worth now trying to add the logic behind the patch (mmc: debugfs:
parse ext_csd via debug_fs (v2)) I sent time ago to parse the EXT_CSD? I can do that on mmc-utils if not yet done. Pls let me know.

Quoted 7 lines
Quoted 5 lines

Yes, please. (If you look farther down in the same message I did mention adding it!)

I think you can add it all to mmc extcsd read, rather than introducing a new command.

Agree! I'll do that and provide a patch asap.

Hello Chris

I've sent the patch to this mailing list.
I will try to do further improvements starting from this first patch, especially to add new parsing conditions for all the register bits (that can be done later according to what we actually need to expose and parser and what you suggest).

Regards
peppe

Quoted 13 lines

peppe

Quoted 4 lines

Thanks,

- Chris.

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html