Skip to contentSkip to conversation

*** SUBJECT HERE ***

PATCH Superseded Peter A. G. Crosthwaite 4 participants 13 messages Jun 7, 2012 – Jun 9, 2012

Subsystems (3)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover *** SUBJECT HERE ***

[Original cover by Igor]
First patch introduces standard SD host controller model. This is accumulated version of my previous patch I sent a while ago and a recent SDHCI patch by Peter A. G. Crosthwaite.
Second patch introduces Exynos4210-specific SDHCI built on top of standard SDHCI model.

[New]
Third patch changes the -sd command line argument to be repeatable, to support multiple SD controllers in one system. Fourth patch adds 2x SDHCI controllers to the Xilinx Zynq machine

Changelog:
Changed from v2:
corrected typo errors in ADMA1 support
added patches 3-4
v1->v2
PATCH1:
add support for ADMA1 (I havn't tested it though).
fixed s->prnsts <-> s->pwrcon typo (thanks to Peter, strange that it even worked before).
PATCH2:
change header prefix from "target-arm" to "exynos4210".

Igor Mitsyanko (2):
hw: introduce standard SD host controller
exynos4210: introduce Exynos4210 SD host controller model

Peter A. G. Crosthwaite (2):
vl.c: allow for reapeated -sd arguments
xilinx_zynq: Added sdhci controllers

 Makefile.objs                   |    1 +
 Makefile.target                 |    1 +
 default-configs/arm-softmmu.mak |    1 +
 hw/exynos4210.c                 |   20 +
 hw/exynos4210_sdhci.c           |  438 +++++++++++++
 hw/sdhci.c                      | 1306 +++++++++++++++++++++++++++++++++++++++
 hw/sdhci.h                      |  310 +++++++++
 hw/xilinx_zynq.c                |   12 +
 vl.c                            |    2 +-
 9 files changed, 2090 insertions(+), 1 deletions(-)
 create mode 100644 hw/exynos4210_sdhci.c
 create mode 100644 hw/sdhci.c
 create mode 100644 hw/sdhci.h
Signature · 1 line
1.7.3.2
#1 lore raw

PATCH v3 1/4 hw: introduce standard SD host controller

From: Igor Mitsyanko <[email protected]>

Device model for standard SD Host Controller Interface (SDHCI) compliant with version 2.00 of SD association specification.

---
changed from v2:
Typographical fixes for adma implementation:
-dscr->attr = (uint8_t)(adma2 & 0x3F);
+dscr->attr = (uint8_t)(adma1 & 0x3F);
-#define SDHC_CTRL_ADMA1_32 0x01
+#define SDHC_CTRL_ADMA1_32 0x08

 Makefile.objs                   |    1 +
 default-configs/arm-softmmu.mak |    1 +
 hw/sdhci.c                      | 1306 +++++++++++++++++++++++++++++++++++++++
 hw/sdhci.h                      |  310 +++++++++
 4 files changed, 1618 insertions(+), 0 deletions(-)
 create mode 100644 hw/sdhci.c
 create mode 100644 hw/sdhci.h
Makefile.objs +1 -0
index 70c5c79..a9c7bb9 100644
@@ -250,6 +250,7 @@ hw-obj-$(CONFIG_SMARTCARD) += usb/dev-smartcard-reader.o ccid-card-passthru.o
 hw-obj-$(CONFIG_SMARTCARD_NSS) += ccid-card-emulated.o
 hw-obj-$(CONFIG_USB_REDIR) += usb/redirect.o
 hw-obj-$(CONFIG_I8259) += i8259_common.o i8259.o
+hw-obj-$(CONFIG_SDHCI) += sdhci.o
 
 # PPC devices
 hw-obj-$(CONFIG_PREP_PCI) += prep_pci.o
default-configs/arm-softmmu.mak +1 -0
index e542b4f..314784b 100644
@@ -27,3 +27,4 @@ CONFIG_SMC91C111=y
 CONFIG_DS1338=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_PFLASH_CFI02=y
+CONFIG_SDHCI=y
hw/sdhci.c new file +1306 -0

1,306 lines not on this page · raw message

hw/sdhci.h new file +310 -0

310 lines not on this page · raw message

Signature · 1 line
1.7.3.2
#4 lore raw

PATCH v3 2/4 exynos4210: introduce Exynos4210 SD host controller model

In reply to Peter A. G. Crosthwaite

From: Igor Mitsyanko <[email protected]>

Exynos4210 SD/MMC host controller is based on SD association standart host controller ver. 2.00

---
 Makefile.target       |    1 +
 hw/exynos4210.c       |   20 +++
 hw/exynos4210_sdhci.c |  438 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 459 insertions(+), 0 deletions(-)
 create mode 100644 hw/exynos4210_sdhci.c
Makefile.target +1 -0
index 1582904..56cdd03 100644
@@ -340,6 +340,7 @@ obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o
 obj-arm-y += exynos4210_gic.o exynos4210_combiner.o exynos4210.o
 obj-arm-y += exynos4_boards.o exynos4210_uart.o exynos4210_pwm.o
 obj-arm-y += exynos4210_pmu.o exynos4210_mct.o exynos4210_fimd.o
+obj-arm-y += exynos4210_sdhci.o
 obj-arm-y += arm_l2x0.o
 obj-arm-y += arm_mptimer.o a15mpcore.o
 obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
hw/exynos4210.c +20 -0
index afc4bdc..4f9d91b 100644
@@ -56,6 +56,12 @@
 #define EXYNOS4210_EXT_COMBINER_BASE_ADDR   0x10440000
 #define EXYNOS4210_INT_COMBINER_BASE_ADDR   0x10448000
 
+/* SD/MMC host controllers SFR base addresses */
+#define EXYNOS4210_SDHC0_BASE_ADDR          0x12510000
+#define EXYNOS4210_SDHC1_BASE_ADDR          0x12520000
+#define EXYNOS4210_SDHC2_BASE_ADDR          0x12530000
+#define EXYNOS4210_SDHC3_BASE_ADDR          0x12540000
+
 /* PMU SFR base address */
 #define EXYNOS4210_PMU_BASE_ADDR            0x10020000
 
@@ -289,6 +295,20 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
                            EXYNOS4210_UART3_FIFO_SIZE, 3, NULL,
                   s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 3)]);
 
+    /*** SD/MMC host controllers ***/
+
+    sysbus_create_simple("exynos4210.sdhci", EXYNOS4210_SDHC0_BASE_ADDR,
+            s->irq_table[exynos4210_get_irq(29, 0)]);
+
+    sysbus_create_simple("exynos4210.sdhci", EXYNOS4210_SDHC1_BASE_ADDR,
+            s->irq_table[exynos4210_get_irq(29, 1)]);
+
+    sysbus_create_simple("exynos4210.sdhci", EXYNOS4210_SDHC2_BASE_ADDR,
+            s->irq_table[exynos4210_get_irq(29, 2)]);
+
+    sysbus_create_simple("exynos4210.sdhci", EXYNOS4210_SDHC3_BASE_ADDR,
+            s->irq_table[exynos4210_get_irq(29, 3)]);
+
     /*** Display controller (FIMD) ***/
     sysbus_create_varargs("exynos4210.fimd", EXYNOS4210_FIMD0_BASE_ADDR,
             s->irq_table[exynos4210_get_irq(11, 0)],
hw/exynos4210_sdhci.c new file +438 -0

438 lines not on this page · raw message

Signature · 1 line
1.7.3.2
#6 lore raw

PATCH v3 3/4 vl.c: allow for reapeated -sd arguments

In reply to Peter A. G. Crosthwaite

Allows for repeating of -sd arugments in the same way -pflash and -mtdblock can be repeated.

---
 vl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
vl.c +1 -1
index 23ab3a3..a381e90 100644
@@ -2437,7 +2437,7 @@ int main(int argc, char **argv, char **envp)
                 drive_add(IF_MTD, -1, optarg, MTD_OPTS);
                 break;
             case QEMU_OPTION_sd:
-                drive_add(IF_SD, 0, optarg, SD_OPTS);
+                drive_add(IF_SD, -1, optarg, SD_OPTS);
                 break;
             case QEMU_OPTION_pflash:
                 drive_add(IF_PFLASH, -1, optarg, PFLASH_OPTS);
Signature · 1 line
1.7.3.2
#8 lore raw

PATCH v3 4/4 xilinx_zynq: Added sdhci controllers

In reply to Peter A. G. Crosthwaite
---
 hw/xilinx_zynq.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
hw/xilinx_zynq.c +12 -0
index 7290c64..42b6e69 100644
@@ -130,6 +130,18 @@ static void zynq_init(ram_addr_t ram_size, const char *boot_device,
         }
     }
 
+	{
+		dev = qdev_create(NULL, "sdhci");
+		qdev_init_nofail(dev);
+		sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0xE0100000);
+		sysbus_connect_irq(sysbus_from_qdev(dev), 0, pic[56-IRQ_OFFSET]);
+
+		dev = qdev_create(NULL, "sdhci");
+		qdev_init_nofail(dev);
+		sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0xE0101000);
+		sysbus_connect_irq(sysbus_from_qdev(dev), 0, pic[79-IRQ_OFFSET]);
+	}
+
     zynq_binfo.ram_size = ram_size;
     zynq_binfo.kernel_filename = kernel_filename;
     zynq_binfo.kernel_cmdline = kernel_cmdline;
Signature · 1 line
1.7.3.2
#7 lore raw

Re: [Qemu-devel] [PATCH v3 3/4] vl.c: allow for reapeated -sd arguments

In reply to Peter A. G. Crosthwaite

Speaking of typos in the cover letter, "repeated" and...

Am 07.06.2012 07:05, schrieb Peter A. G. Crosthwaite:

Quoted 1 line

Allows for repeating of -sd arugments in the same way -pflash and -mtdblock

..."arguments".

Quoted 3 lines

can be repeated.

Multiple SD controllers indeed need to be supported, patch looks good.

Andreas

Quoted 17 lines
---
 vl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
vl.c +1 -1
index 23ab3a3..a381e90 100644
@@ -2437,7 +2437,7 @@ int main(int argc, char **argv, char **envp)
                 drive_add(IF_MTD, -1, optarg, MTD_OPTS);
                 break;
             case QEMU_OPTION_sd:
-                drive_add(IF_SD, 0, optarg, SD_OPTS);
+                drive_add(IF_SD, -1, optarg, SD_OPTS);
                 break;
             case QEMU_OPTION_pflash:
                 drive_add(IF_PFLASH, -1, optarg, PFLASH_OPTS);
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#5 lore raw

Re: [Qemu-devel] [PATCH v3 2/4] exynos4210: introduce Exynos4210 SD host controller model

In reply to Peter A. G. Crosthwaite

Am 07.06.2012 07:05, schrieb Peter A. G. Crosthwaite:

Quoted 3 lines

From: Igor Mitsyanko <[email protected]>

Exynos4210 SD/MMC host controller is based on SD association standart host

Another one: "standard"

Quoted 3 lines

controller ver. 2.00

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#9 lore raw

Re: [Qemu-devel] [PATCH v3 0/4] Standard SD host controller model

In reply to Peter A. G. Crosthwaite

Am 07.06.2012 07:05, schrieb Peter A. G. Crosthwaite:

Quoted 10 lines

[Original cover by Igor]
First patch introduces standard SD host controller model. This is accumulated version of my previous patch I sent a while ago and a recent SDHCI patch by Peter A. G. Crosthwaite.
Second patch introduces Exynos4210-specific SDHCI built on top of standard SDHCI model.

[New]
Third patch changes the -sd command line argument to be repeatable, to support multiple SD controllers in one system. Fourth patch adds 2x SDHCI controllers to the Xilinx Zynq machine

It's good to see agreement finally being reached here. Looking forward to testing it on my tegra branch. Vincent's version claimed compliance to version 3.00 while this one says 2.00. What's the delta then, Igor?

http://git.chromium.org/gitweb/?p=chromiumos/third_party/qemu.git;a=commit;h=9b9c2ea8bd25be06b23a30f07262ade9190d8e95

I'm guessing I at least still need to cherry-pick Vincent's eMMC support bits on top since hw/sd.c and hw/blockdev.c are unmodified in this series.

I'm cc'ing Kevin as block maintainer (PMM is on vacation). I'm hoping the typos in the commit messages can be fixed when applying to either branch.

Regards,
Andreas

Quoted 34 lines

Changelog:
Changed from v2:
corrected typo errors in ADMA1 support
added patches 3-4
v1->v2
PATCH1:
add support for ADMA1 (I havn't tested it though).
fixed s->prnsts <-> s->pwrcon typo (thanks to Peter, strange that it even worked before).
PATCH2:
change header prefix from "target-arm" to "exynos4210".

Igor Mitsyanko (2):
hw: introduce standard SD host controller
exynos4210: introduce Exynos4210 SD host controller model

Peter A. G. Crosthwaite (2):
vl.c: allow for reapeated -sd arguments
xilinx_zynq: Added sdhci controllers

 Makefile.objs                   |    1 +
 Makefile.target                 |    1 +
 default-configs/arm-softmmu.mak |    1 +
 hw/exynos4210.c                 |   20 +
 hw/exynos4210_sdhci.c           |  438 +++++++++++++
 hw/sdhci.c                      | 1306 +++++++++++++++++++++++++++++++++++++++
 hw/sdhci.h                      |  310 +++++++++
 hw/xilinx_zynq.c                |   12 +
 vl.c                            |    2 +-
 9 files changed, 2090 insertions(+), 1 deletions(-)
 create mode 100644 hw/exynos4210_sdhci.c
 create mode 100644 hw/sdhci.c
 create mode 100644 hw/sdhci.h
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#10 lore raw

Re: [Qemu-devel] [PATCH v3 0/4] Standard SD host controller model

Quoted 2 lines · Andreas Färber

I'm guessing I at least still need to cherry-pick Vincent's eMMC support bits on top since hw/sd.c and hw/blockdev.c are unmodified in this series.

I never did get round to looking at how those overlapped with the MMC support patches from Nokia that are currently in qemu-linaro...

Quoted 1 line

(PMM is on vacation)

I haven't looked at the code (being on holiday :-)) but am happy for it all to go in if (a) all interested parties are in agreement about it and (b) somebody's reviewed it.

--- PMM

#11 lore raw

Re: [Qemu-devel] [PATCH v3 0/4] Standard SD host controller model

In reply to Andreas Färber
Quoted 8 lines · Andreas Färber

Am 07.06.2012 07:05, schrieb Peter A. G. Crosthwaite:

Quoted 7 lines

[Original cover by Igor]
First patch introduces standard SD host controller model. This is accumulated version of my previous patch I sent a while ago and a recent SDHCI patch by Peter A. G. Crosthwaite.
Second patch introduces Exynos4210-specific SDHCI built on top of standard SDHCI model.

Quoted 8 lines
Quoted 3 lines

[New]
Third patch changes the -sd command line argument to be repeatable, to support multiple SD controllers in one system. Fourth patch adds 2x SDHCI controllers to the Xilinx Zynq machine

It's good to see agreement finally being reached here. Looking forward to testing it on my tegra branch. Vincent's version claimed compliance to version 3.00 while this one says 2.00. What's the delta then, Igor?

http://git.chromium.org/gitweb/?p=chromiumos/third_party/qemu.git;a=commit;h=9b9c2ea8bd25be06b23a30f07262ade9190d8e95

Looks like its not actually true, the first thing I noticed is that documentation defines mandatory 3.00 controller registers Host Control 2 and Preset Values, which Vincent's version doesn't implement, I'd say that his version complies with 2.00 spec. Version sent by Peter implements a wider set of SD host controller features comparing to Vincen't version.

Quoted 45 lines

I'm guessing I at least still need to cherry-pick Vincent's eMMC support bits on top since hw/sd.c and hw/blockdev.c are unmodified in this series.

I'm cc'ing Kevin as block maintainer (PMM is on vacation). I'm hoping the typos in the commit messages can be fixed when applying to either branch.

Regards,
Andreas

Quoted 34 lines

Changelog:
Changed from v2:
corrected typo errors in ADMA1 support
added patches 3-4
v1->v2
PATCH1:
add support for ADMA1 (I havn't tested it though).
fixed s->prnsts<-> s->pwrcon typo (thanks to Peter, strange that it even worked before).
PATCH2:
change header prefix from "target-arm" to "exynos4210".

Igor Mitsyanko (2):
hw: introduce standard SD host controller
exynos4210: introduce Exynos4210 SD host controller model

Peter A. G. Crosthwaite (2):
vl.c: allow for reapeated -sd arguments
xilinx_zynq: Added sdhci controllers

  Makefile.objs                   |    1 +
  Makefile.target                 |    1 +
  default-configs/arm-softmmu.mak |    1 +
  hw/exynos4210.c                 |   20 +
  hw/exynos4210_sdhci.c           |  438 +++++++++++++
  hw/sdhci.c                      | 1306 +++++++++++++++++++++++++++++++++++++++
  hw/sdhci.h                      |  310 +++++++++
  hw/xilinx_zynq.c                |   12 +
  vl.c                            |    2 +-
  9 files changed, 2090 insertions(+), 1 deletions(-)

create mode 100644 hw/exynos4210_sdhci.c
create mode 100644 hw/sdhci.c
create mode 100644 hw/sdhci.h

#12 lore raw

Re: [Qemu-devel] [PATCH v3 0/4] Standard SD host controller model

Quoted 8 lines
Quoted 1 line

http://git.chromium.org/gitweb/?p=chromiumos/third_party/qemu.git;a=commit;h=9b9c2ea8bd25be06b23a30f07262ade9190d8e95

Looks like its not actually true, the first thing I noticed is that documentation defines mandatory 3.00 controller registers Host Control 2 and Preset Values, which Vincent's version doesn't implement, I'd say that his version complies with 2.00 spec. Version sent by Peter implements a wider set of SD host controller features comparing to Vincen't version.

There are two major deltas that I added to vincents that are now in Igors version:

1: PIO support
2: ADMA1 supoorts

I removed from Vincents version

1: PCI support
2: the aforementioned eMMC stuff

Although this was mostly just a case of not picking those patches out of the original series.

Quoted 48 lines
Quoted 47 lines

I'm guessing I at least still need to cherry-pick Vincent's eMMC support bits on top since hw/sd.c and hw/blockdev.c are unmodified in this series.

I'm cc'ing Kevin as block maintainer (PMM is on vacation). I'm hoping the typos in the commit messages can be fixed when applying to either branch.

Regards,
Andreas

Quoted 36 lines

Changelog:
Changed from v2:
corrected typo errors in ADMA1 support
added patches 3-4
v1->v2
 PATCH1:
  add support for ADMA1 (I havn't tested it though).
  fixed s->prnsts<->  s->pwrcon typo (thanks to Peter, strange that it even worked
  before).
 PATCH2:
  change header prefix from "target-arm" to "exynos4210".

Igor Mitsyanko (2):
  hw: introduce standard SD host controller
  exynos4210: introduce Exynos4210 SD host controller model

Peter A. G. Crosthwaite (2):
  vl.c: allow for reapeated -sd arguments
  xilinx_zynq: Added sdhci controllers

 Makefile.objs                   |    1 + Makefile.target                 |    1 + default-configs/arm-softmmu.mak |    1 + hw/exynos4210.c                 |   20 + hw/exynos4210_sdhci.c           |  438 +++++++++++++ hw/sdhci.c                      | 1306
+++++++++++++++++++++++++++++++++++++++
 hw/sdhci.h                      |  310 +++++++++ hw/xilinx_zynq.c                |   12 + vl.c                            |    2 +-

 9 files changed, 2090 insertions(+), 1 deletions(-)

 create mode 100644 hw/exynos4210_sdhci.c
 create mode 100644 hw/sdhci.c
 create mode 100644 hw/sdhci.h

#2 lore raw

Re: [Qemu-devel] [PATCH v3 1/4] hw: introduce standard SD host controller

In reply to Peter A. G. Crosthwaite

Am 07.06.2012 07:05, schrieb Peter A. G. Crosthwaite:

Makefile.objs hw-obj-$(CONFIG_SMARTCARD) += usb/dev-smartcard-reader.o ccid-card-passthru.o · line 256

Quoted 12 lines
Makefile.objs +1 -0
index 70c5c79..a9c7bb9 100644
@@ -250,6 +250,7 @@ hw-obj-$(CONFIG_SMARTCARD) += usb/dev-smartcard-reader.o ccid-card-passthru.o
 hw-obj-$(CONFIG_SMARTCARD_NSS) += ccid-card-emulated.o
 hw-obj-$(CONFIG_USB_REDIR) += usb/redirect.o
 hw-obj-$(CONFIG_I8259) += i8259_common.o i8259.o
+hw-obj-$(CONFIG_SDHCI) += sdhci.o
 
 # PPC devices
 hw-obj-$(CONFIG_PREP_PCI) += prep_pci.o

This hunk needs to go into hw/Makefile.objs with the new system (compile-tested with tegra2).

The ones for exynos and zynq into hw/arm/Makefile.objs. I'm guessing there's no Big Endian version of exynos or zynq, so that location should be fine.

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#3 lore raw

Re: [Qemu-devel] [PATCH v3 1/4] hw: introduce standard SD host controller

In reply to Peter A. G. Crosthwaite

Am 07.06.2012 07:05, schrieb Peter A. G. Crosthwaite:

Quoted 7 lines

From: Igor Mitsyanko <[email protected]>

Device model for standard SD Host Controller Interface (SDHCI) compliant with version 2.00 of SD association specification.

[...]

Quoted 6 lines
hw/sdhci.h new file +0 -0
new file mode 100644
index 0000000..afd0772
@@ -0,0 +1,310 @@

[...]

Quoted 2 lines
hw/sdhci.h new file +2 -0
+#ifndef _SDHC_H_
+#define _SDHC_H_

[...]

Quoted 1 line

+#endif /* _SDHC_H_ */

Minor nit: Our malc insists on not using reserved identifiers starting with underscore. s/_SDHC_H_/SDHCI_H/g ?

/-F

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg