Re: [PATCH v1 1/5] ARM: imx28: add basic dt support

2012-03-15 Thread s.ha...@pengutronix.de
On Thu, Mar 15, 2012 at 06:59:28PM +0800, Dong Aisheng wrote:
 On Thu, Mar 15, 2012 at 02:53:29PM +0800, Lothar Waßmann wrote:
  Hi,
  
  Dong Aisheng writes:
   On Wed, Mar 14, 2012 at 10:16:43PM +0800, s.ha...@pengutronix.de wrote:
On Wed, Mar 14, 2012 at 08:45:23PM +0800, Dong Aisheng wrote:
 On Wed, Mar 14, 2012 at 01:23:51AM +0800, Grant Likely wrote:
  [...]
 But it seems this needs pass mac address to fec driver via platforom 
 data which is
 not friendly to dt.
 
 Another way may be changing fec driver to get the fixed part of mac 
 address(first
 two bytes) from device tree and read the left dynamical part from otp 
 which i'm not
 sure is better enough.
 
 BTW, filling with zeros seems not work since it's invalid mac address.

Yes, that's the idea of using this value...

   But comparing to use an invalid value, why not just do not define that
   local-mac-address property?
   
  Because a MAC address is by definition a GLOBALLY UNIQUE IDENTIFIER
  which is contrary to coding a valid default value for it somewhere!
  The owner of a certain MAC address range (OUI) is responsible for
  ensuring the uniqueness. Thus only they may assign a specific MAC
  address to a specific device.
  
 Yes, you're correct.
 So i propose to read the MAC address from MX28 OTP in fec driver instead of
 define it in device tree in my last mail.
 http://www.spinics.net/lists/arm-kernel/msg165040.html
 Do you have any comment on that way?

Yes, you could do that. Otherwise it's perfectly fine to pass the MAC
address in the device tree, it's just not ok to put specific values
into the kernel source. You could leave the values blank and let the
bootloader fill them in. Or you could fill in valid values before you
compile the devicetree, but be prepared for surprises once you have
two boards in your network and use the devicetree for both.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v1 2/5] mmc: mxs-mmc: add dt probe support

2012-03-14 Thread s.ha...@pengutronix.de
On Wed, Mar 14, 2012 at 08:09:22AM +0100, Marek Vasut wrote:
 Dear Dong Aisheng,
 
  On Wed, Mar 14, 2012 at 01:58:25PM +0800, Marek Vasut wrote:
   Dear Dong Aisheng,
   
Signed-off-by: Dong Aisheng dong.aish...@linaro.org
  
  
  
+static const struct of_device_id mxs_mmc_dt_ids[] = {
+   { .compatible = fsl,imx23-mmc, .data = NULL, },
+   { .compatible = fsl,imx28-mmc, .data = NULL, },
   
   Do you really need two distinct ones here?
  
  Hmm, my original purpose is to put soc difference data in .data
  to remove cpu_is_* function calls in the driver later.
  Do you think if any issue?
  
 
 Well, what's the difference between the interfaces on mx233 and mx28? Is it 
 something that can't be encoded otherwise? I think they're not so different.

They differ in the register layout. Matching two different compatible
strings is the right way here I think.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v1 1/5] ARM: imx28: add basic dt support

2012-03-14 Thread s.ha...@pengutronix.de
On Wed, Mar 14, 2012 at 08:45:23PM +0800, Dong Aisheng wrote:
 On Wed, Mar 14, 2012 at 01:23:51AM +0800, Grant Likely wrote:
  On Tue, 13 Mar 2012 16:47:04 +0800, Dong Aisheng b29...@freescale.com 
  wrote:
   From: Dong Aisheng dong.aish...@linaro.org
   
   This patch includes basic dt support which can boot via nfs rootfs.
   
   Signed-off-by: Dong Aisheng dong.aish...@linaro.org
   ---
Documentation/devicetree/bindings/arm/fsl.txt |4 +
arch/arm/boot/dts/imx28-evk.dts   |   31 +
arch/arm/boot/dts/imx28.dtsi  |   88 
   +
arch/arm/mach-mxs/Kconfig |9 +++
arch/arm/mach-mxs/Makefile|1 +
arch/arm/mach-mxs/imx28-dt.c  |   67 +++
6 files changed, 200 insertions(+), 0 deletions(-)
   
   diff --git a/Documentation/devicetree/bindings/arm/fsl.txt 
   b/Documentation/devicetree/bindings/arm/fsl.txt
   index 54bddda..9f21faf 100644
   --- a/Documentation/devicetree/bindings/arm/fsl.txt
   +++ b/Documentation/devicetree/bindings/arm/fsl.txt
   @@ -1,6 +1,10 @@
Freescale i.MX Platforms Device Tree Bindings
---

   +i.MX28 Evaluation Kit
   +Required root node properties:
   +- compatible = fsl,imx28-evk, fsl,imx28;
   +
i.MX51 Babbage Board
Required root node properties:
- compatible = fsl,imx51-babbage, fsl,imx51;
   diff --git a/arch/arm/boot/dts/imx28-evk.dts 
   b/arch/arm/boot/dts/imx28-evk.dts
   new file mode 100644
   index 000..9758dc4
   --- /dev/null
   +++ b/arch/arm/boot/dts/imx28-evk.dts
   @@ -0,0 +1,31 @@
   +/*
   + * Copyright 2012 Freescale Semiconductor, Inc.
   + *
   + * The code contained herein is licensed under the GNU General Public
   + * License. You may obtain a copy of the GNU General Public License
   + * Version 2 or later at the following locations:
   + *
   + * http://www.opensource.org/licenses/gpl-license.html
   + * http://www.gnu.org/copyleft/gpl.html
   + */
   +
   +/dts-v1/;
   +/include/ imx28.dtsi
   +
   +/ {
   + model = Freescale i.MX28 Evaluation Kit;
   + compatible = fsl,imx28-evk, fsl,imx28;
   +
   + memory {
   + device_type = memory;
   + reg = 0x4000 0x0800;
   + };
   +
   + ahb@8008 {
   + fec@800f {
   + phy-mode = rmii;
   + local-mac-address = [00 04 9F 01 7D 5B];
  
  Generally a bad idea to put a specific mac address into the device tree.
  Better to fill it with zeros.  Otherwise all the dev boards will end up 
  using
  the same value.
  
 Yes, this issue also exists on other platfroms like mx6q.
 One way is to dynamically get mac address by reading otp register as non-dt 
 does
 like:
 static int __init mx28evk_fec_get_mac(void)
 {
 int i;
 u32 val;
 const u32 *ocotp = mxs_get_ocotp();
 
 if (!ocotp)
 return -ETIMEDOUT;
 
 /*
  * OCOTP only stores the last 4 octets for each mac address,
  * so hard-code Freescale OUI (00:04:9f) here.
  */
 for (i = 0; i  2; i++) {
 val = ocotp[i];
 mx28_fec_pdata[i].mac[0] = 0x00;
 mx28_fec_pdata[i].mac[1] = 0x04;
 mx28_fec_pdata[i].mac[2] = 0x9f;
 mx28_fec_pdata[i].mac[3] = (val  16)  0xff;
 mx28_fec_pdata[i].mac[4] = (val  8)  0xff;
 mx28_fec_pdata[i].mac[5] = (val  0)  0xff;
 }
 
 return 0;
 }
 
 But it seems this needs pass mac address to fec driver via platforom data 
 which is
 not friendly to dt.
 
 Another way may be changing fec driver to get the fixed part of mac 
 address(first
 two bytes) from device tree and read the left dynamical part from otp which 
 i'm not
 sure is better enough.
 
 BTW, filling with zeros seems not work since it's invalid mac address.

Yes, that's the idea of using this value...

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html