]> git.sur5r.net Git - u-boot/commitdiff
rockchip: syscon: Update to work with of-platdata
authorSimon Glass <sjg@chromium.org>
Mon, 4 Jul 2016 17:58:33 +0000 (11:58 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 15 Jul 2016 02:40:24 +0000 (20:40 -0600)
The syscon devices all end up having diffent driver names with of-platdata,
since the driver name comes from the first string in the compatible list.
Add separate device declarations for each one, and add a bind method to set
up driver_data correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/arm/mach-rockchip/rk3288/syscon_rk3288.c

index c9f7c4e32f44b883cb22052e23f48b0f858e107b..be4b2b00c30b78a98a5919e19280ccb93bb3127a 100644 (file)
@@ -23,3 +23,41 @@ U_BOOT_DRIVER(syscon_rk3288) = {
        .id = UCLASS_SYSCON,
        .of_match = rk3288_syscon_ids,
 };
+
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+static int rk3288_syscon_bind_of_platdata(struct udevice *dev)
+{
+       dev->driver_data = dev->driver->of_match->data;
+       debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data);
+
+       return 0;
+}
+
+U_BOOT_DRIVER(rockchip_rk3288_noc) = {
+       .name = "rockchip_rk3288_noc",
+       .id = UCLASS_SYSCON,
+       .of_match = rk3288_syscon_ids,
+       .bind = rk3288_syscon_bind_of_platdata,
+};
+
+U_BOOT_DRIVER(rockchip_rk3288_grf) = {
+       .name = "rockchip_rk3288_grf",
+       .id = UCLASS_SYSCON,
+       .of_match = rk3288_syscon_ids + 1,
+       .bind = rk3288_syscon_bind_of_platdata,
+};
+
+U_BOOT_DRIVER(rockchip_rk3288_sgrf) = {
+       .name = "rockchip_rk3288_sgrf",
+       .id = UCLASS_SYSCON,
+       .of_match = rk3288_syscon_ids + 2,
+       .bind = rk3288_syscon_bind_of_platdata,
+};
+
+U_BOOT_DRIVER(rockchip_rk3288_pmu) = {
+       .name = "rockchip_rk3288_pmu",
+       .id = UCLASS_SYSCON,
+       .of_match = rk3288_syscon_ids + 3,
+       .bind = rk3288_syscon_bind_of_platdata,
+};
+#endif