Re: [PATCH v3 5/6] mmc: dw_mmc: add device tree support

2012-07-17 Thread Thomas Abraham
On 16 July 2012 09:45, Girish K S girish.shivananja...@linaro.org wrote:
 On 12 July 2012 18:24, Thomas Abraham thomas.abra...@linaro.org wrote:

[...]


 +#ifdef CONFIG_OF
 +static struct dw_mci_drv_data synopsis_drv_data = {
 +   .ctrl_type  = DW_MCI_TYPE_SYNOPSIS,
 +};
 +
 +static const struct of_device_id dw_mci_pltfm_match[] = {
 +   { .compatible = snps,dw-mshc,
 +   .data = (void *)synopsis_drv_data, },
 +   {},
 +};
 +MODULE_DEVICE_TABLE(of, dw_mci_pltfm_match);
 +#else
 +static const struct of_device_id dw_mci_pltfm_match[];
 the #else and a statement can be completely removed if of_match_ptr is
 used while accessing the dw_mci_pltfm_match in of_match_node function.
 +#endif
 +
  static int dw_mci_pltfm_probe(struct platform_device *pdev)
  {
 struct dw_mci *host;
 @@ -51,6 +67,13 @@ static int dw_mci_pltfm_probe(struct platform_device 
 *pdev)
 if (!host-regs)
 goto err_free;
 platform_set_drvdata(pdev, host);
 +
 +   if (pdev-dev.of_node) {
 +   const struct of_device_id *match;
 +   match = of_match_node(dw_mci_pltfm_match, pdev-dev.of_node);
 can be modified to of_match_node(of_match_pt(dw_mci_pltfm_match),
 pdev-dev.of_node);
 This will remove the dummy allocation of variable as mentioned above.
 Also it will be generic in non dt case.

Ok. Thanks for the suggestion. I will modify it as per your suggestion.

Thanks,
Thomas.

[...]
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 5/6] mmc: dw_mmc: add device tree support

2012-07-17 Thread Thomas Abraham
On 16 July 2012 09:53, Chris Ball c...@laptop.org wrote:
 Hi,

 On Thu, Jul 12 2012, Thomas Abraham wrote:
 diff --git a/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt 
 b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
 new file mode 100644
 index 000..3acd6c9
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
 @@ -0,0 +1,108 @@
 +* Synopsis Designware Mobile Storage Host Controller
 +
 +The Synopsis designware mobile storage host controller is used to interface
 +a SoC with storage medium such as eMMC or SD/MMC cards.
 +
 +Required Properties:
 +
 +* compatible: should be one of the following
 + - snps,dw-mshc: for controllers compliant with synopsis dw-mshc.
 +
 +* reg: physical base address of the dw-mshc controller and size of its 
 memory
 +  region.
 +
 +* interrupts: interrupt specifier for the controller. The format and value 
 of
 +  the interrupt specifier depends on the interrupt parent for the 
 controller.

 Please instead add:

 This file documents differences between the core properties described
 by mmc.txt and the properties used by the dw_mmc driver.

 mmc.txt already describes compatible, reg, interrupts, bus-width,
 cd-gpios, and wp-gpios, so you don't need to describe those again.

Ok. I will change it.


 + cnt = sizeof(of_quriks) / sizeof(struct dw_mci_of_quirks);
 + for (idx = 0; idx  cnt; idx++)
 + if (of_get_property(np, of_quriks[idx].quirk, NULL))
 + pdata-quirks |= of_quriks[idx].id;

 of_quirks, not of_quriks.

Yes, thanks for pointing this out. I will fix this.

Thanks,
Thomas.
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 5/6] mmc: dw_mmc: add device tree support

2012-07-15 Thread Girish K S
On 12 July 2012 18:24, Thomas Abraham thomas.abra...@linaro.org wrote:
 Add device tree based discovery support.

 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
  .../devicetree/bindings/mmc/synposis-dw-mshc.txt   |  108 +++
  drivers/mmc/host/dw_mmc-pltfm.c|   24 +++
  drivers/mmc/host/dw_mmc.c  |  201 
 +++-
  drivers/mmc/host/dw_mmc.h  |9 +
  include/linux/mmc/dw_mmc.h |2 +
  5 files changed, 338 insertions(+), 6 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt

 diff --git a/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt 
 b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
 new file mode 100644
 index 000..3acd6c9
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
 @@ -0,0 +1,108 @@
 +* Synopsis Designware Mobile Storage Host Controller
 +
 +The Synopsis designware mobile storage host controller is used to interface
 +a SoC with storage medium such as eMMC or SD/MMC cards.
 +
 +Required Properties:
 +
 +* compatible: should be one of the following
 +   - snps,dw-mshc: for controllers compliant with synopsis dw-mshc.
 +
 +* reg: physical base address of the dw-mshc controller and size of its memory
 +  region.
 +
 +* interrupts: interrupt specifier for the controller. The format and value of
 +  the interrupt specifier depends on the interrupt parent for the controller.
 +
 +* #address-cells: should be 1.
 +
 +* #size-cells: should be 0.
 +
 +# Slots: The slot specific information are contained within child-nodes with
 +  each child-node representing a supported slot. There should be atleast one
 +  child node representing a card slot. The name of the child node 
 representing
 +  the slot is recommended to be slot@n where n is the unique number of the 
 slot
 +  connnected to the controller. The following are optional properties which
 +  can be included in the slot child node.
 +
 +   * reg: specifies the physical slot number. The valid values of this
 + property is 0 to (num-slots -1), where num-slots is the value
 + specified by the num-slots property.
 +
 +   * bus-width: specifies the width of the data bus connected from the
 + controller to the card slot. The value should be 1, 4 or 8. In case
 + this property is not specified, a default value of 1 is assumed for
 + this property.
 +
 +   * cd-gpios: specifies the card detect gpio line. The format of the
 + gpio specifier depends on the gpio controller.
 +
 +   * wp-gpios: specifies the write protect gpio line. The format of the
 + gpio specifier depends on the gpio controller.
 +
 +   * gpios: specifies a list of gpios used for command, clock and data
 + bus. The first gpio is the command line and the second gpio is the
 + clock line. The rest of the gpios (depending on the bus-width
 + property) are the data lines in no particular order. The format of
 + the gpio specifier depends on the gpio controller.
 +
 +Optional properties:
 +
 +* num-slots: specifies the number of slots supported by the controller.
 +  The number of physical slots actually used could be equal or less than the
 +  value specified by num-slots. If this property is not specified, the value
 +  of num-slot property is assumed to be 1.
 +
 +* fifo-depth: The maximum size of the tx/rx fifo's. If this property is not
 +  specified, the default value of the fifo size is determined from the
 +  controller registers.
 +
 +* card-detect-delay: Delay in milli-seconds before detecting card after card
 +  insert event. The default value is 0.
 +
 +* supports-highspeed: Enables support for high speed cards (upto 50MHz)
 +
 +* card-detection-broken: The card detection functionality is not available on
 +  any of the slots.
 +
 +* no-write-protect: The write protect pad of the controller is not connected
 +  to the write protect pin on the slot.
 +
 +Aliases:
 +
 +- All the MSHC controller nodes should be represented in the aliases node 
 using
 +  the following format 'mshc{n}' where n is a unique number for the alias.
 +
 +
 +Example:
 +
 +  The MSHC controller node can be split into two portions, SoC specific and
 +  board specific portions as listed below.
 +
 +   dwmmc0@1220 {
 +   compatible = snps,dw-mshc;
 +   reg = 0x1220 0x1000;
 +   interrupts = 0 75 0;
 +   #address-cells = 1;
 +   #size-cells = 0;
 +   };
 +
 +   dwmmc0@1220 {
 +   num-slots = 1;
 +   supports-highspeed;
 +   card-detection-broken;
 +   no-write-protect;
 +   fifo-depth = 0x80;
 +   card-detect-delay = 200;
 +
 +   slot@0 {
 +   reg = 0;
 +   bus-width = 8;
 

Re: [PATCH v3 5/6] mmc: dw_mmc: add device tree support

2012-07-15 Thread Chris Ball
Hi,

On Thu, Jul 12 2012, Thomas Abraham wrote:
 diff --git a/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt 
 b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
 new file mode 100644
 index 000..3acd6c9
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
 @@ -0,0 +1,108 @@
 +* Synopsis Designware Mobile Storage Host Controller
 +
 +The Synopsis designware mobile storage host controller is used to interface
 +a SoC with storage medium such as eMMC or SD/MMC cards.
 +
 +Required Properties:
 +
 +* compatible: should be one of the following
 + - snps,dw-mshc: for controllers compliant with synopsis dw-mshc.
 +
 +* reg: physical base address of the dw-mshc controller and size of its memory
 +  region.
 +
 +* interrupts: interrupt specifier for the controller. The format and value of
 +  the interrupt specifier depends on the interrupt parent for the controller.

Please instead add:

This file documents differences between the core properties described
by mmc.txt and the properties used by the dw_mmc driver.

mmc.txt already describes compatible, reg, interrupts, bus-width,
cd-gpios, and wp-gpios, so you don't need to describe those again.

 + cnt = sizeof(of_quriks) / sizeof(struct dw_mci_of_quirks);
 + for (idx = 0; idx  cnt; idx++)
 + if (of_get_property(np, of_quriks[idx].quirk, NULL))
 + pdata-quirks |= of_quriks[idx].id;

of_quirks, not of_quriks.

Thanks,

- Chris.
-- 
Chris Ball   c...@laptop.org   http://printf.net/
One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 5/6] mmc: dw_mmc: add device tree support

2012-07-15 Thread Girish K S
On 16 July 2012 09:45, Girish K S girish.shivananja...@linaro.org wrote:
 On 12 July 2012 18:24, Thomas Abraham thomas.abra...@linaro.org wrote:
 Add device tree based discovery support.

 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
  .../devicetree/bindings/mmc/synposis-dw-mshc.txt   |  108 +++
  drivers/mmc/host/dw_mmc-pltfm.c|   24 +++
  drivers/mmc/host/dw_mmc.c  |  201 
 +++-
  drivers/mmc/host/dw_mmc.h  |9 +
  include/linux/mmc/dw_mmc.h |2 +
  5 files changed, 338 insertions(+), 6 deletions(-)
  create mode 100644 
 Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt

 diff --git a/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt 
 b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
 new file mode 100644
 index 000..3acd6c9
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt
 @@ -0,0 +1,108 @@
 +* Synopsis Designware Mobile Storage Host Controller
 +
 +The Synopsis designware mobile storage host controller is used to interface
 +a SoC with storage medium such as eMMC or SD/MMC cards.
 +
 +Required Properties:
 +
 +* compatible: should be one of the following
 +   - snps,dw-mshc: for controllers compliant with synopsis dw-mshc.
 +
 +* reg: physical base address of the dw-mshc controller and size of its 
 memory
 +  region.
 +
 +* interrupts: interrupt specifier for the controller. The format and value 
 of
 +  the interrupt specifier depends on the interrupt parent for the 
 controller.
 +
 +* #address-cells: should be 1.
 +
 +* #size-cells: should be 0.
 +
 +# Slots: The slot specific information are contained within child-nodes with
 +  each child-node representing a supported slot. There should be atleast one
 +  child node representing a card slot. The name of the child node 
 representing
 +  the slot is recommended to be slot@n where n is the unique number of the 
 slot
 +  connnected to the controller. The following are optional properties which
 +  can be included in the slot child node.
 +
 +   * reg: specifies the physical slot number. The valid values of this
 + property is 0 to (num-slots -1), where num-slots is the value
 + specified by the num-slots property.
 +
 +   * bus-width: specifies the width of the data bus connected from the
 + controller to the card slot. The value should be 1, 4 or 8. In case
 + this property is not specified, a default value of 1 is assumed for
 + this property.
 +
 +   * cd-gpios: specifies the card detect gpio line. The format of the
 + gpio specifier depends on the gpio controller.
 +
 +   * wp-gpios: specifies the write protect gpio line. The format of the
 + gpio specifier depends on the gpio controller.
 +
 +   * gpios: specifies a list of gpios used for command, clock and data
 + bus. The first gpio is the command line and the second gpio is the
 + clock line. The rest of the gpios (depending on the bus-width
 + property) are the data lines in no particular order. The format of
 + the gpio specifier depends on the gpio controller.
 +
 +Optional properties:
 +
 +* num-slots: specifies the number of slots supported by the controller.
 +  The number of physical slots actually used could be equal or less than the
 +  value specified by num-slots. If this property is not specified, the value
 +  of num-slot property is assumed to be 1.
 +
 +* fifo-depth: The maximum size of the tx/rx fifo's. If this property is not
 +  specified, the default value of the fifo size is determined from the
 +  controller registers.
 +
 +* card-detect-delay: Delay in milli-seconds before detecting card after card
 +  insert event. The default value is 0.
 +
 +* supports-highspeed: Enables support for high speed cards (upto 50MHz)
 +
 +* card-detection-broken: The card detection functionality is not available 
 on
 +  any of the slots.
 +
 +* no-write-protect: The write protect pad of the controller is not connected
 +  to the write protect pin on the slot.
 +
 +Aliases:
 +
 +- All the MSHC controller nodes should be represented in the aliases node 
 using
 +  the following format 'mshc{n}' where n is a unique number for the alias.
 +
 +
 +Example:
 +
 +  The MSHC controller node can be split into two portions, SoC specific and
 +  board specific portions as listed below.
 +
 +   dwmmc0@1220 {
 +   compatible = snps,dw-mshc;
 +   reg = 0x1220 0x1000;
 +   interrupts = 0 75 0;
 +   #address-cells = 1;
 +   #size-cells = 0;
 +   };
 +
 +   dwmmc0@1220 {
 +   num-slots = 1;
 +   supports-highspeed;
 +   card-detection-broken;
 +   no-write-protect;
 +   fifo-depth = 0x80;
 +   card-detect-delay = 200;
 +
 +