Patch to mach-pxa/generic.c to conditionally register HWUART

From: Matthew Reimer <mreimer_at_vpop.net>
Date: Wed, 13 Apr 2005 12:26:54 -0700

I'd like to commit the PXA HWUART patch, but Phil suggested that HWUART
platform devices only be added if the processor really has one, because
earlier PXAs will crash if non-existent registers are written to. So below is
my patch to do this. Is this the proper way? It works on h2200, but I don't
have any other devices to test against.

FYI, below are the cpuids for the PXAs I know about:

        cpuid coregen corerev prodno prodrev
                        15:13 12:10 9:4 3:0
PXA210 0x6905_2922 001 010 010010
PXA250 0x6905_2100 001 000 010000
PXA255 0x6905_2d06 001 011 010000
PXA26x 0x6905_2903 001 010 010000
PXA27x 0x6905_4110 010 000 010001

Let me know if this looks right so I can commit the whole HWUART patch.

Matt

@@ -240,7 +245,21 @@ static struct platform_device *devices[]
 
 static int __init pxa_init(void)
 {
- return platform_add_devices(devices, ARRAY_SIZE(devices));
+ int cpuid, ret;
+
+ ret = platform_add_devices(devices, ARRAY_SIZE(devices));
+ if (ret) {
+ printk(KERN_WARNING "Unable to add PXA platform devices");
+ return ret;
+ }
+
+ /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
+ cpuid = read_cpuid(CPUID_ID);
+ if (((cpuid >> 4) & 0xfff) == 0x2d0 ||
+ ((cpuid >> 4) & 0xfff) == 0x290)
+ ret = platform_device_register(&hwuart_device);
+
+ return ret;
 }
 
 subsys_initcall(pxa_init);
Received on Wed Apr 13 2005 - 15:30:43 EDT

This archive was generated by hypermail 2.2.0 : Mon Jul 25 2005 - 17:26:42 EDT