summaryrefslogtreecommitdiff
path: root/include/tsec.h
diff options
context:
space:
mode:
authorAndy Fleming <afleming@freescale.com>2008-08-31 16:33:26 -0500
committerBen Warren <biggerbadderben@gmail.com>2008-09-02 21:18:15 -0700
commit75b9d4ae0d69f214eab641caf12ce8af83a39a42 (patch)
tree61614a99bcfc7389d0c337edde151dac29a98af5 /include/tsec.h
parentdd3d1f56a01f460d560766126ee7dfed2ea9bc10 (diff)
downloadu-boot-imx-75b9d4ae0d69f214eab641caf12ce8af83a39a42.zip
u-boot-imx-75b9d4ae0d69f214eab641caf12ce8af83a39a42.tar.gz
u-boot-imx-75b9d4ae0d69f214eab641caf12ce8af83a39a42.tar.bz2
Pass in tsec_info struct through tsec_initialize
The tsec driver contains a hard-coded array of configuration information for the tsec ethernet controllers. We create a default function that works for most tsecs, and allow that to be overridden by board code. It creates an array of tsec_info structures, which are then parsed by the corresponding driver instance to determine configuration. Also, add regs, miiregs, and devname fields to the tsec_info structure, so that we don't need the kludgy "index" parameter. Signed-off-by: Andy Fleming <afleming@freescale.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Diffstat (limited to 'include/tsec.h')
-rw-r--r--include/tsec.h32
1 files changed, 28 insertions, 4 deletions
diff --git a/include/tsec.h b/include/tsec.h
index 83863ae..c05b5f0 100644
--- a/include/tsec.h
+++ b/include/tsec.h
@@ -27,12 +27,30 @@
#define TSEC_SIZE 0x01000
/* FIXME: Should these be pushed back to 83xx and 85xx config files? */
-#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
- #define TSEC_BASE_ADDR (CFG_IMMR + CFG_TSEC1_OFFSET)
-#elif defined(CONFIG_MPC83XX)
+#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) \
+ || defined(CONFIG_MPC83XX)
#define TSEC_BASE_ADDR (CFG_IMMR + CFG_TSEC1_OFFSET)
#endif
+#define STD_TSEC_INFO(num) \
+{ \
+ .regs = (tsec_t *)(TSEC_BASE_ADDR + ((num - 1) * TSEC_SIZE)), \
+ .miiregs = (tsec_t *)TSEC_BASE_ADDR, \
+ .devname = CONFIG_TSEC##num##_NAME, \
+ .phyaddr = TSEC##num##_PHY_ADDR, \
+ .flags = TSEC##num##_FLAGS \
+}
+
+#define SET_STD_TSEC_INFO(x, num) \
+{ \
+ x.regs = (tsec_t *)(TSEC_BASE_ADDR + ((num - 1) * TSEC_SIZE)); \
+ x.miiregs = (tsec_t *)TSEC_BASE_ADDR; \
+ x.devname = CONFIG_TSEC##num##_NAME; \
+ x.phyaddr = TSEC##num##_PHY_ADDR; \
+ x.flags = TSEC##num##_FLAGS;\
+}
+
+
#define MAC_ADDR_LEN 6
@@ -584,9 +602,15 @@ struct phy_info {
};
struct tsec_info_struct {
+ tsec_t *regs;
+ tsec_t *miiregs;
+ char *devname;
unsigned int phyaddr;
u32 flags;
- unsigned int phyregidx;
};
+int tsec_initialize(bd_t * bis, struct tsec_info_struct *tsec_info);
+int tsec_standard_init(bd_t *bis);
+int tsec_eth_init(bd_t *bis, struct tsec_info_struct *tsec_info, int num);
+
#endif /* __TSEC_H */