Re: [U-Boot] [PATCH v2 04/10] arm: ls102xa: Add etsec support for LS102xA

2014-08-11 Thread AlisonWang
On 07/03/2014 12:24 AM, Alison Wang wrote: 

Missing commit message here. 

[Alison Wang] Yes, I will add in v3.

 Signed-off-by: Alison Wang [hidden email] 
 --- 
 Change log: 
  v2: Add private mdio read and write support. 
 
  drivers/net/fsl_mdio.c | 24 +++- 
  drivers/net/tsec.c |  7 +++ 
  include/fsl_mdio.h |  3 +++ 
  include/tsec.h |  7 ++- 
  4 files changed, 35 insertions(+), 6 deletions(-) 
 
 diff --git a/drivers/net/fsl_mdio.c b/drivers/net/fsl_mdio.c 
 index 8d09f5d..3081228 100644 
 --- a/drivers/net/fsl_mdio.c 
 +++ b/drivers/net/fsl_mdio.c 
 @@ -12,6 +12,15 @@ 
  #include asm/io.h 
  #include asm/errno.h 
   
 +void tsec_mdio_sync(void) 
 +{ 
 +#if defined(CONFIG_PPC) 
 + asm(sync); 
 +#elif defined(CONFIG_ARM) 
 + asm(dsb); 
 +#endif 
 +} 
 + 
  void tsec_local_mdio_write(struct tsec_mii_mng __iomem *phyregs, int
 port_addr, 
   int dev_addr, int regnum, int value) 
  { 
 @@ -19,7 +28,7 @@ void tsec_local_mdio_write(struct tsec_mii_mng __iomem
 *phyregs, int port_addr, 
   
   out_be32(phyregs-miimadd, (port_addr  8) | (regnum  0x1f)); 
   out_be32(phyregs-miimcon, value); 
 - asm(sync); 
 + tsec_mdio_sync(); 
  

Don't reinvent the wheel. You can use mb() where you use tsec_mdio_sync(); 

[Alison Wang] Yes, I will change in v3. Thanks.

Best Regards,
Alison Wang



--
View this message in context: 
http://u-boot.10912.n7.nabble.com/PATCH-v2-0-9-arm-ls102xa-Add-Freescale-LS102xA-SoC-and-LS1021AQDS-TWR-board-support-tp183468p186446.html
Sent from the U-Boot mailing list archive at Nabble.com.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 04/10] arm: ls102xa: Add etsec support for LS102xA

2014-08-06 Thread York Sun
On 07/03/2014 12:24 AM, Alison Wang wrote:

Missing commit message here.

 Signed-off-by: Alison Wang alison.w...@freescale.com
 ---
 Change log:
  v2: Add private mdio read and write support. 
 
  drivers/net/fsl_mdio.c | 24 +++-
  drivers/net/tsec.c |  7 +++
  include/fsl_mdio.h |  3 +++
  include/tsec.h |  7 ++-
  4 files changed, 35 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/net/fsl_mdio.c b/drivers/net/fsl_mdio.c
 index 8d09f5d..3081228 100644
 --- a/drivers/net/fsl_mdio.c
 +++ b/drivers/net/fsl_mdio.c
 @@ -12,6 +12,15 @@
  #include asm/io.h
  #include asm/errno.h
  
 +void tsec_mdio_sync(void)
 +{
 +#if defined(CONFIG_PPC)
 + asm(sync);
 +#elif defined(CONFIG_ARM)
 + asm(dsb);
 +#endif
 +}
 +
  void tsec_local_mdio_write(struct tsec_mii_mng __iomem *phyregs, int 
 port_addr,
   int dev_addr, int regnum, int value)
  {
 @@ -19,7 +28,7 @@ void tsec_local_mdio_write(struct tsec_mii_mng __iomem 
 *phyregs, int port_addr,
  
   out_be32(phyregs-miimadd, (port_addr  8) | (regnum  0x1f));
   out_be32(phyregs-miimcon, value);
 - asm(sync);
 + tsec_mdio_sync();
  

Don't reinvent the wheel. You can use mb() where you use tsec_mdio_sync();

York

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 04/10] arm: ls102xa: Add etsec support for LS102xA

2014-07-03 Thread Alison Wang
Signed-off-by: Alison Wang alison.w...@freescale.com
---
Change log:
 v2: Add private mdio read and write support. 

 drivers/net/fsl_mdio.c | 24 +++-
 drivers/net/tsec.c |  7 +++
 include/fsl_mdio.h |  3 +++
 include/tsec.h |  7 ++-
 4 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/drivers/net/fsl_mdio.c b/drivers/net/fsl_mdio.c
index 8d09f5d..3081228 100644
--- a/drivers/net/fsl_mdio.c
+++ b/drivers/net/fsl_mdio.c
@@ -12,6 +12,15 @@
 #include asm/io.h
 #include asm/errno.h
 
+void tsec_mdio_sync(void)
+{
+#if defined(CONFIG_PPC)
+   asm(sync);
+#elif defined(CONFIG_ARM)
+   asm(dsb);
+#endif
+}
+
 void tsec_local_mdio_write(struct tsec_mii_mng __iomem *phyregs, int port_addr,
int dev_addr, int regnum, int value)
 {
@@ -19,7 +28,7 @@ void tsec_local_mdio_write(struct tsec_mii_mng __iomem 
*phyregs, int port_addr,
 
out_be32(phyregs-miimadd, (port_addr  8) | (regnum  0x1f));
out_be32(phyregs-miimcon, value);
-   asm(sync);
+   tsec_mdio_sync();
 
while ((in_be32(phyregs-miimind)  MIIMIND_BUSY)  timeout--)
;
@@ -37,11 +46,11 @@ int tsec_local_mdio_read(struct tsec_mii_mng __iomem 
*phyregs, int port_addr,
 
/* Clear the command register, and wait */
out_be32(phyregs-miimcom, 0);
-   asm(sync);
+   tsec_mdio_sync();
 
/* Initiate a read command, and wait */
out_be32(phyregs-miimcom, MIIMCOM_READ_CYCLE);
-   asm(sync);
+   tsec_mdio_sync();
 
/* Wait for the the indication that the read is done */
while ((in_be32(phyregs-miimind)  (MIIMIND_NOTVALID | MIIMIND_BUSY))
@@ -98,8 +107,13 @@ int fsl_pq_mdio_init(bd_t *bis, struct fsl_pq_mdio_info 
*info)
return -1;
}
 
-   bus-read = tsec_phy_read;
-   bus-write = tsec_phy_write;
+   if (info-priv_mdio_read) {
+   bus-read = info-priv_mdio_read;
+   bus-write = info-priv_mdio_write;
+   } else {
+   bus-read = tsec_phy_read;
+   bus-write = tsec_phy_write;
+   }
bus-reset = fsl_pq_mdio_reset;
sprintf(bus-name, info-name);
 
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index e9138f0..a220221 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -20,6 +20,7 @@
 #include fsl_mdio.h
 #include asm/errno.h
 #include asm/processor.h
+#include asm/io.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -270,6 +271,9 @@ void redundant_init(struct eth_device *dev)
out_be32(regs-tstat, TSTAT_CLEAR_THALT);
out_be32(regs-rstat, RSTAT_CLEAR_RHALT);
clrbits_be32(regs-dmactrl, DMACTRL_GRS | DMACTRL_GTS);
+#ifdef CONFIG_LS102xA
+   setbits_be32(regs-dmactrl, DMACTRL_LE);
+#endif
 
do {
uint16_t status;
@@ -366,6 +370,9 @@ static void startup_tsec(struct eth_device *dev)
out_be32(regs-tstat, TSTAT_CLEAR_THALT);
out_be32(regs-rstat, RSTAT_CLEAR_RHALT);
clrbits_be32(regs-dmactrl, DMACTRL_GRS | DMACTRL_GTS);
+#ifdef CONFIG_LS102xA
+   setbits_be32(regs-dmactrl, DMACTRL_LE);
+#endif
 }
 
 /* This returns the status bits of the device. The return value
diff --git a/include/fsl_mdio.h b/include/fsl_mdio.h
index a531edf..fb7df08 100644
--- a/include/fsl_mdio.h
+++ b/include/fsl_mdio.h
@@ -57,6 +57,9 @@ int memac_mdio_read(struct mii_dev *bus, int port_addr, int 
dev_addr,
 struct fsl_pq_mdio_info {
struct tsec_mii_mng __iomem *regs;
char *name;
+   int (*priv_mdio_read)(struct mii_dev *bus, int addr, int devad, int 
reg);
+   int (*priv_mdio_write)(struct mii_dev *bus, int addr, int devad, int 
reg,
+   u16 val);
 };
 int fsl_pq_mdio_init(bd_t *bis, struct fsl_pq_mdio_info *info);
 
diff --git a/include/tsec.h b/include/tsec.h
index 2054715..5b74f67 100644
--- a/include/tsec.h
+++ b/include/tsec.h
@@ -20,10 +20,14 @@
 #include net.h
 #include config.h
 #include phy.h
-#include fsl_mdio.h
 
+#ifdef CONFIG_LS102xA
+#define TSEC_SIZE  0x4
+#define TSEC_MDIO_OFFSET   0x4
+#else
 #define TSEC_SIZE  0x01000
 #define TSEC_MDIO_OFFSET   0x01000
+#endif
 
 #define CONFIG_SYS_MDIO_BASE_ADDR (MDIO_BASE_ADDR + 0x520)
 
@@ -128,6 +132,7 @@
 #define DMACTRL_INIT_SETTINGS  0x00c3
 #define DMACTRL_GRS0x0010
 #define DMACTRL_GTS0x0008
+#define DMACTRL_LE 0x8000
 
 #define TSTAT_CLEAR_THALT  0x8000
 #define RSTAT_CLEAR_RHALT  0x0080
-- 
1.8.0

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot