[U-Boot] [PATCH v2 06/10] powerpc/ppc4xx: Use generic FPGA accessors on all gdsys 405ep/ex boards

Dirk Eibach dirk.eibach at gdsys.cc
Mon May 6 17:55:22 CEST 2013


Hi Wolfgang,

Am 06.05.2013 17:22, schrieb Wolfgang Denk:
> Dear Dirk Eibach,
> 
> In message <e8fccb4d422d619744521268691e5a9b at gdsys.cc> you wrote:
>> 
>>> You had the this, and now attempt to throw it away.  This makes no
>>> sense.
>> 
>> In fact it does.
>> We have FPGAs that are memory mapped and others that are not. They 
>> must
>> be accessed by the same drivers. So the alternative would be to 
>> create
>> FPGA instances at address NULL and getting the register offesets by
>> casting pointers to u16. Not very nice either.
> 
> Your new code still boils down to using the same standard I/O
> accessors.
> 
> So your FPGA registers must be mapped somehow to I/O memory.
> 
> When you can do something like
> 
> +u16 fpga_get_reg(unsigned int fpga, u16 reg)
> +{
> +	return in_le16((u16 *)CONFIG_SYS_FPGA_BASE(fpga) + reg / 
> sizeof(u16));
> +}
> 
> why would you not be able to continue using in_le16() directly?
> 
> Sorry, I don't get it.

Read the source, Luke :)

On our iocon platform you find:

+void fpga_set_reg(unsigned int fpga, u16 reg, u16 data)
+{
+	int res;
+	struct ihs_fpga *fpga_0 = (struct ihs_fpga *)CONFIG_SYS_FPGA_BASE(0);
+
+	switch (fpga) {
+	case 0:
+		out_le16((u16 *)fpga_0 + reg / sizeof(u16), data);
+		break;
+	default:
+		res = mclink_send(fpga - 1, reg, data);
+		if (res < 0)
+			printf("mclink_send reg %02x data %04x returned %d\n",
+			       reg, data, res);
+		break;
+	}
+}

So no memory mapping here. That's the reason for all this fuzz.

And sorry for the messed up series. Sometimes rebase can make things 
worse :)

Cheers
Dirk


More information about the U-Boot mailing list