aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <sebastian@breakpoint.cc>2010-04-27 18:54:50 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-27 18:54:50 -0400
commit8cd9b13207f9a38e4da2d69bba51eb8dcbe1ead9 (patch)
tree7c2f3c1d924de4be492410ea108721245400887e /arch
parentfa12abd7d3fbaa9f86f97baeb445cb71189ae1d1 (diff)
net/sb1250: setup the pdevice within the soc code
doing it within the driver does not look good. And surely isn't how platform devices were meat to be used. Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/sibyte/swarm/platform.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/arch/mips/sibyte/swarm/platform.c b/arch/mips/sibyte/swarm/platform.c
index 54847fe1e564..097335262fb3 100644
--- a/arch/mips/sibyte/swarm/platform.c
+++ b/arch/mips/sibyte/swarm/platform.c
@@ -83,3 +83,57 @@ static int __init swarm_pata_init(void)
83device_initcall(swarm_pata_init); 83device_initcall(swarm_pata_init);
84 84
85#endif /* defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_LITTLESUR) */ 85#endif /* defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_LITTLESUR) */
86
87#define sb1250_dev_struct(num) \
88 static struct resource sb1250_res##num = { \
89 .name = "SB1250 MAC " __stringify(num), \
90 .flags = IORESOURCE_MEM, \
91 .start = A_MAC_CHANNEL_BASE(num), \
92 .end = A_MAC_CHANNEL_BASE(num + 1) -1, \
93 };\
94 static struct platform_device sb1250_dev##num = { \
95 .name = "sb1250-mac", \
96 .id = num, \
97 .resource = &sb1250_res##num, \
98 .num_resources = 1, \
99 }
100
101sb1250_dev_struct(0);
102sb1250_dev_struct(1);
103sb1250_dev_struct(2);
104sb1250_dev_struct(3);
105
106static struct platform_device *sb1250_devs[] __initdata = {
107 &sb1250_dev0,
108 &sb1250_dev1,
109 &sb1250_dev2,
110 &sb1250_dev3,
111};
112
113static int __init sb1250_device_init(void)
114{
115 int ret;
116
117 /* Set the number of available units based on the SOC type. */
118 switch (soc_type) {
119 case K_SYS_SOC_TYPE_BCM1250:
120 case K_SYS_SOC_TYPE_BCM1250_ALT:
121 ret = platform_add_devices(sb1250_devs, 3);
122 break;
123 case K_SYS_SOC_TYPE_BCM1120:
124 case K_SYS_SOC_TYPE_BCM1125:
125 case K_SYS_SOC_TYPE_BCM1125H:
126 case K_SYS_SOC_TYPE_BCM1250_ALT2: /* Hybrid */
127 ret = platform_add_devices(sb1250_devs, 2);
128 break;
129 case K_SYS_SOC_TYPE_BCM1x55:
130 case K_SYS_SOC_TYPE_BCM1x80:
131 ret = platform_add_devices(sb1250_devs, 4);
132 break;
133 default:
134 ret = -ENODEV;
135 break;
136 }
137 return ret;
138}
139device_initcall(sb1250_device_init);