|
@@ -338,3 +338,61 @@ static struct resource ts78xx_ts_rng_resource
|
|
|
= DEFINE_RES_MEM(TS_RNG_DATA, 4);
|
|
|
|
|
|
static struct timeriomem_rng_data ts78xx_ts_rng_data = {
|
|
|
+ .period = 1000000, /* one second */
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device ts78xx_ts_rng_device = {
|
|
|
+ .name = "timeriomem_rng",
|
|
|
+ .id = -1,
|
|
|
+ .dev = {
|
|
|
+ .platform_data = &ts78xx_ts_rng_data,
|
|
|
+ },
|
|
|
+ .resource = &ts78xx_ts_rng_resource,
|
|
|
+ .num_resources = 1,
|
|
|
+};
|
|
|
+
|
|
|
+static int ts78xx_ts_rng_load(void)
|
|
|
+{
|
|
|
+ int rc;
|
|
|
+
|
|
|
+ if (ts78xx_fpga.supports.ts_rng.init == 0) {
|
|
|
+ rc = platform_device_register(&ts78xx_ts_rng_device);
|
|
|
+ if (!rc)
|
|
|
+ ts78xx_fpga.supports.ts_rng.init = 1;
|
|
|
+ } else
|
|
|
+ rc = platform_device_add(&ts78xx_ts_rng_device);
|
|
|
+
|
|
|
+ if (rc)
|
|
|
+ pr_info("RNG could not be registered: %d\n", rc);
|
|
|
+ return rc;
|
|
|
+};
|
|
|
+
|
|
|
+static void ts78xx_ts_rng_unload(void)
|
|
|
+{
|
|
|
+ platform_device_del(&ts78xx_ts_rng_device);
|
|
|
+}
|
|
|
+
|
|
|
+/*****************************************************************************
|
|
|
+ * FPGA 'hotplug' support code
|
|
|
+ ****************************************************************************/
|
|
|
+static void ts78xx_fpga_devices_zero_init(void)
|
|
|
+{
|
|
|
+ ts78xx_fpga.supports.ts_rtc.init = 0;
|
|
|
+ ts78xx_fpga.supports.ts_nand.init = 0;
|
|
|
+ ts78xx_fpga.supports.ts_rng.init = 0;
|
|
|
+}
|
|
|
+
|
|
|
+static void ts78xx_fpga_supports(void)
|
|
|
+{
|
|
|
+ /* TODO: put this 'table' into ts78xx-fpga.h */
|
|
|
+ switch (ts78xx_fpga.id) {
|
|
|
+ case TS7800_REV_1:
|
|
|
+ case TS7800_REV_2:
|
|
|
+ case TS7800_REV_3:
|
|
|
+ case TS7800_REV_4:
|
|
|
+ case TS7800_REV_5:
|
|
|
+ case TS7800_REV_6:
|
|
|
+ case TS7800_REV_7:
|
|
|
+ case TS7800_REV_8:
|
|
|
+ case TS7800_REV_9:
|
|
|
+ ts78xx_fpga.supports.ts_rtc.present = 1;
|