Skip to contentSkip to conversation

Migrate ML300 reference design to the platform bus

PATCH In review Grant C. Likely 2 participants 3 messages Jan 19, 2006 – Jan 23, 2006 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

PATCH 4/9 Migrate ML300 reference design to the platform bus

---

 arch/ppc/Kconfig.debug                |    2 -
 arch/ppc/platforms/4xx/xilinx_ml300.c |   74 +++++++++++++++++++++++----------
 arch/ppc/platforms/4xx/xilinx_ml300.h |    2 -
 arch/ppc/syslib/Makefile              |    2 -
 4 files changed, 55 insertions(+), 25 deletions(-)

8fd96565cd93fa8d3d6165e463353efdc4f9a5c5

arch/ppc/Kconfig.debug +1 -1
index 61653cb..8cc75ab 100644
@@ -67,7 +67,7 @@ config SERIAL_TEXT_DEBUG
 
 config PPC_OCP
 	bool
-	depends on IBM_OCP || XILINX_OCP
+	depends on IBM_OCP
 	default y
 
 endmenu
arch/ppc/platforms/4xx/xilinx_ml300.c +52 -22

113 lines not on this page · raw message

arch/ppc/platforms/4xx/xilinx_ml300.h +1 -1
index 8993981..ae8bf13 100644
@@ -41,7 +41,7 @@ typedef struct board_info {
 #define PPC4xx_ONB_IO_VADDR	0u
 #define PPC4xx_ONB_IO_SIZE	0u
 
-#define PPC4xx_MACHINE_NAME "Xilinx ML300"
+#define PPC4xx_MACHINE_NAME "Xilinx ML300 Reference System"
 
 #endif /* __ASM_XILINX_ML300_H__ */
 #endif /* __KERNEL__ */
arch/ppc/syslib/Makefile +1 -1
index 6234ee5..5cb62c6 100644
@@ -18,7 +18,7 @@ obj-$(CONFIG_440SP)		+= ibm440gx_common.
 obj-$(CONFIG_440SPE)		+= ibm440gx_common.o ibm440sp_common.o ppc440spe_pcie.o
 ifeq ($(CONFIG_4xx),y)
 ifeq ($(CONFIG_XILINX_VIRTEX),y)
-obj-$(CONFIG_40x)		+= xilinx_pic.o
+obj-$(CONFIG_40x)		+= xilinx_pic.o ppc_sys.o
 else
 ifeq ($(CONFIG_403),y)
 obj-$(CONFIG_40x)		+= ppc403_pic.o
Signature · 1 line
1.1.GIT
#1 lore raw

Hi Grant,

Quoted 9 lines · Grant C. Likely

---

 arch/ppc/Kconfig.debug                |    2 -
 arch/ppc/platforms/4xx/xilinx_ml300.c |   74 +++++++++++++++++++++++----------
 arch/ppc/platforms/4xx/xilinx_ml300.h |    2 -
 arch/ppc/syslib/Makefile              |    2 -
 4 files changed, 55 insertions(+), 25 deletions(-)

<snip>

arch/ppc/platforms/4xx/xilinx_ml300.c line 66

Quoted 8 lines
arch/ppc/platforms/4xx/xilinx_ml300.c +8 -0
+/* Board specifications structures */
+struct ppc_sys_spec *cur_ppc_sys_spec;
+struct ppc_sys_spec ppc_sys_specs[] = {
+	{
+		/* Only one entry, always assume the same design */
+		.ppc_sys_name	= "Xilinx ML300 Reference Design",
+		.mask 		= 0x00000000,
+		.value 		= 0x00000000,

"Always assume the same design" could be a considerable limitation for the Virtex FPGAs.

<snip>

arch/ppc/platforms/4xx/xilinx_ml300.c platform_init(unsigned long r3, unsigned · line 162

Quoted 5 lines
arch/ppc/platforms/4xx/xilinx_ml300.c +1 -0
@@ -131,6 +159,8 @@ platform_init(unsigned long r3, unsigned
 {
 	ppc4xx_init(r3, r4, r5, r6, r7);
 
+	identify_ppc_sys_by_id(mfspr(SPRN_PVR));

This is OK for the single ppc_sys_specs[] case, but in general
I am not sure using PVR to identify the system makes much sense in case of Virtex FPGAs. IIRC, for the mpc8xxx Freescale SOCs PVR gives enough information to determine what on-chip peripherals are present (but not how multi-function peripherals like SCC are configured). In case of Xilinx the situation is worse: depending on the bitstream loaded into the FPGA, the same chip (the same PVR) and the board can have several sets of on-chip peripherals which could be completely different from each other. And knowing the PVR value alone puts no limitation on what peripherals could get into the FPGA (unless e.g. a Virtex-4 specific hardware block is used by an IP - like in case of TEMAC).

What do you think?

So far I've used a fairly dumb code like:

  static int __init xilinx_platform_init(void)
  {
  #ifdef XPAR_EMAC_0_BASEADDR
        memcpy(xemac_0_pdata.mac_addr, __res.bi_enetaddr, 6);
        platform_device_register(&xilinx_emac_0_device);
  #endif /* XPAR_EMAC_0_BASEADDR */

  #ifdef XPAR_TEMAC_0_BASEADDR
        memcpy(xtemac_0_pdata.mac_addr, __res.bi_enetaddr, 6);
        platform_device_register(&xilinx_temac_0_device);
  #endif /* XPAR_TEMAC_0_BASEADDR */

  #ifdef XPAR_TFT_0_BASEADDR
        platform_device_register(&xilinx_lcd_0_device);
  #endif /* XPAR_TFT_0_BASEADDR */

  #ifdef XPAR_GPIO_0_BASEADDR
        platform_device_register(&xilinx_gpio_0_device);
  #endif /* XPAR_GPIO_0_BASEADDR */
  #ifdef XPAR_GPIO_1_BASEADDR
        platform_device_register(&xilinx_gpio_1_device);
  #endif /* XPAR_GPIO_1_BASEADDR */

  #ifdef XPAR_PS2_0_BASEADDR
        platform_device_register(&xilinx_ps2_0_device);
  #endif /* XPAR_PS2_0_BASEADDR */
  #ifdef XPAR_PS2_1_BASEADDR
        platform_device_register(&xilinx_ps2_1_device);
  #endif /* XPAR_PS2_1_BASEADDR */
	return 0;

}

- to associate the devices to the drivers (the drivers call driver_register() from their module_init function). This helps me holding all that ugly stuff in one file (this single file can be used by multiple boards), and should make it easier to switch to something using the flattened device tree parsing when the OF DT comes into play.

Probably using ppc_sys infrastructure now has some advantages, but they are not evident to me.

Thanks,
Andrei

#2 lore raw
Quoted 52 lines · Andrei Konovalov

Hi Grant,

Quoted 10 lines · Grant C. Likely

---

 arch/ppc/Kconfig.debug                |    2 -
 arch/ppc/platforms/4xx/xilinx_ml300.c |   74 
+++++++++++++++++++++++----------
 arch/ppc/platforms/4xx/xilinx_ml300.h |    2 -
 arch/ppc/syslib/Makefile              |    2 -
 4 files changed, 55 insertions(+), 25 deletions(-)

<snip>

arch/ppc/platforms/4xx/xilinx_ml300.c line 66

Quoted 8 lines
arch/ppc/platforms/4xx/xilinx_ml300.c +8 -0
+/* Board specifications structures */
+struct ppc_sys_spec *cur_ppc_sys_spec;
+struct ppc_sys_spec ppc_sys_specs[] = {
+    {
+        /* Only one entry, always assume the same design */
+        .ppc_sys_name    = "Xilinx ML300 Reference Design",
+        .mask         = 0x00000000,
+        .value         = 0x00000000,

"Always assume the same design" could be a considerable limitation for the Virtex FPGAs.

<snip>

arch/ppc/platforms/4xx/xilinx_ml300.c platform_init(unsigned long r3, unsigned · line 162

Quoted 5 lines
arch/ppc/platforms/4xx/xilinx_ml300.c +1 -0
@@ -131,6 +159,8 @@ platform_init(unsigned long r3, unsigned
 {
     ppc4xx_init(r3, r4, r5, r6, r7);
 
+    identify_ppc_sys_by_id(mfspr(SPRN_PVR));

This is OK for the single ppc_sys_specs[] case, but in general
I am not sure using PVR to identify the system makes much sense in case of Virtex FPGAs. IIRC, for the mpc8xxx Freescale SOCs PVR gives enough information to determine what on-chip peripherals are present (but not how multi-function peripherals like SCC are configured). In case of Xilinx the situation is worse: depending on the bitstream loaded into the FPGA, the same chip (the same PVR) and the board can have several sets of on-chip peripherals which could be completely different from each other. And knowing the PVR value alone puts no limitation on what peripherals could get into the FPGA (unless e.g. a Virtex-4 specific hardware block is used by an IP - like in case of TEMAC).

Quoted 1 line

What do you think?

In short; I agree 100%. There are also some other issues with the way I set things up. The only reason I used the ppc_sys functions was because the other freescale ports used them. (It seemed like a good starting point). I now thing platform devices should be registered directly by the board setup code (or flattened-device-tree parser); just like your code below.

Quoted 35 lines

So far I've used a fairly dumb code like:

  static int __init xilinx_platform_init(void)
  {
  #ifdef XPAR_EMAC_0_BASEADDR
        memcpy(xemac_0_pdata.mac_addr, __res.bi_enetaddr, 6);
        platform_device_register(&xilinx_emac_0_device);
  #endif /* XPAR_EMAC_0_BASEADDR */

  #ifdef XPAR_TEMAC_0_BASEADDR
        memcpy(xtemac_0_pdata.mac_addr, __res.bi_enetaddr, 6);
        platform_device_register(&xilinx_temac_0_device);
  #endif /* XPAR_TEMAC_0_BASEADDR */

  #ifdef XPAR_TFT_0_BASEADDR
        platform_device_register(&xilinx_lcd_0_device);
  #endif /* XPAR_TFT_0_BASEADDR */

  #ifdef XPAR_GPIO_0_BASEADDR
        platform_device_register(&xilinx_gpio_0_device);
  #endif /* XPAR_GPIO_0_BASEADDR */
  #ifdef XPAR_GPIO_1_BASEADDR
        platform_device_register(&xilinx_gpio_1_device);
  #endif /* XPAR_GPIO_1_BASEADDR */

  #ifdef XPAR_PS2_0_BASEADDR
        platform_device_register(&xilinx_ps2_0_device);
  #endif /* XPAR_PS2_0_BASEADDR */
  #ifdef XPAR_PS2_1_BASEADDR
        platform_device_register(&xilinx_ps2_1_device);
  #endif /* XPAR_PS2_1_BASEADDR */
    return 0;

}

Quoted 7 lines

- to associate the devices to the drivers (the drivers call driver_register() from their module_init function). This helps me holding all that ugly stuff in one file (this single file can be used by multiple boards), and should make it easier to switch to something using the flattened device tree parsing when the OF DT comes into play.

yes; plus the flattened tree parser can allocate platform device structures as needed at runtime.

Quoted 3 lines

Probably using ppc_sys infrastructure now has some advantages, but they are not evident to me.

No, I don't really think it fits for the Virtex either; I'm just using it as a starting point.

Cheers,
g.

Signature · 3 lines
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
(403) 663-0761