[sw] Software updates for lfsr removal

- Also update entropy_src_smoketest to match

Signed-off-by: Timothy Chen <timothytim@google.com>
diff --git a/sw/device/lib/dif/dif_entropy_src.c b/sw/device/lib/dif/dif_entropy_src.c
index 3f94380..c6cdee6 100644
--- a/sw/device/lib/dif/dif_entropy_src.c
+++ b/sw/device/lib/dif/dif_entropy_src.c
@@ -37,6 +37,10 @@
   reg = bitfield_field32_write(reg, ENTROPY_SRC_CONF_RNG_BIT_SEL_FIELD,
                                rng_bit_sel);
 
+  uint32_t sw_rd_en = config->route_to_firmware ? 0xa : 0x5;
+  reg = bitfield_field32_write(
+      reg, ENTROPY_SRC_CONF_ENTROPY_DATA_REG_ENABLE_FIELD, sw_rd_en);
+
   // Enable configuration
   uint32_t enable_val = config->mode != kDifEntropySrcModeDisabled ? 0xa : 0x5;
   reg = bitfield_field32_write(reg, ENTROPY_SRC_CONF_ENABLE_FIELD, enable_val);
@@ -58,7 +62,6 @@
     return kDifBadArg;
   }
 
-
   // Conditioning bypass is hardcoded to enabled. Bypass is not intended as
   // a regular mode of operation.
   uint32_t es_route_val = config.route_to_firmware ? 0xa : 0x5;
diff --git a/sw/device/lib/dif/dif_entropy_src.h b/sw/device/lib/dif/dif_entropy_src.h
index edf140c..691e1eb 100644
--- a/sw/device/lib/dif/dif_entropy_src.h
+++ b/sw/device/lib/dif/dif_entropy_src.h
@@ -231,6 +231,7 @@
    * Configuration parameters for health tests.
    */
   dif_entropy_src_test_config_t test_config;
+
 } dif_entropy_src_config_t;
 
 /**
diff --git a/sw/device/lib/dif/dif_entropy_src_unittest.cc b/sw/device/lib/dif/dif_entropy_src_unittest.cc
index ac56336..14a2354 100644
--- a/sw/device/lib/dif/dif_entropy_src_unittest.cc
+++ b/sw/device/lib/dif/dif_entropy_src_unittest.cc
@@ -38,7 +38,7 @@
       .reset_health_test_registers = false,
       .single_bit_mode = kDifEntropySrcSingleBitModeDisabled,
       .route_to_firmware = false,
-      .fips_mode = false,1
+      .fips_mode = false,
       .test_config = {0},
   };
 };
@@ -47,7 +47,6 @@
   EXPECT_EQ(dif_entropy_src_configure(nullptr, {}), kDifBadArg);
 }
 
-
 struct ConfigParams {
   dif_entropy_src_mode_t mode;
   dif_entropy_src_single_bit_mode_t single_bit_mode;
@@ -76,15 +75,13 @@
                       (uint32_t)(test_param.route_to_firmware ? 0xa : 0x5)},
                      {ENTROPY_SRC_ENTROPY_CONTROL_ES_TYPE_OFFSET, 0x5},
                  });
-  EXPECT_WRITE32(ENTROPY_SRC_FW_OV_CONTROL_REG_OFFSET, 0);
+  EXPECT_WRITE32(ENTROPY_SRC_FW_OV_CONTROL_REG_OFFSET, 0x55);
 
   // Current dif does not perform a read modified write
   // EXPECT_READ32(ENTROPY_SRC_CONF_REG_OFFSET, 0);
 
   uint32_t rng_bit_enable = test_param.expected_rng_bit_en ? 0xa : 0x5;
-  // Current dif does not set these fields
-
-  // uint32_t route_to_fw = test_param.route_to_firmware ? 0xa : 0x5;
+  uint32_t route_to_fw = test_param.route_to_firmware ? 0xa : 0x5;
   uint32_t enable =
       test_param.expected_mode != kDifEntropySrcModeDisabled ? 0xa : 0x5;
   uint32_t reset_ht = test_param.reset_health_test_registers ? 0xa : 0x5;
@@ -95,8 +92,7 @@
           {ENTROPY_SRC_CONF_RNG_BIT_ENABLE_OFFSET, rng_bit_enable},
           {ENTROPY_SRC_CONF_HEALTH_TEST_CLR_OFFSET, reset_ht},
           {ENTROPY_SRC_CONF_BOOT_BYPASS_DISABLE_OFFSET, 0x5},
-          // Current dif doesn ot set these fields
-          //{ENTROPY_SRC_CONF_ENTROPY_DATA_REG_ENABLE_OFFSET, route_to_fw},
+          {ENTROPY_SRC_CONF_ENTROPY_DATA_REG_ENABLE_OFFSET, route_to_fw},
           {ENTROPY_SRC_CONF_ENABLE_OFFSET, enable},
       });
 
@@ -125,14 +121,14 @@
                      kDifEntropySrcSingleBitModeDisabled, true, true, 2, false,
                      0, 4},
         // Test single_bit_mode
-        ConfigParams{kDifEntropySrcModePtrng, kDifEntropySrcSingleBitMode0, true,
-                     true, 2, true, 0, 4},
-        ConfigParams{kDifEntropySrcModePtrng, kDifEntropySrcSingleBitMode1, true,
-                     true, 2, true, 1, 4},
-        ConfigParams{kDifEntropySrcModePtrng, kDifEntropySrcSingleBitMode2, true,
-                     true, 2, true, 2, 4},
-        ConfigParams{kDifEntropySrcModePtrng, kDifEntropySrcSingleBitMode3, true,
-                     true, 2, true, 3, 4}));
+        ConfigParams{kDifEntropySrcModePtrng, kDifEntropySrcSingleBitMode0,
+                     true, true, 2, true, 0, 4},
+        ConfigParams{kDifEntropySrcModePtrng, kDifEntropySrcSingleBitMode1,
+                     true, true, 2, true, 1, 4},
+        ConfigParams{kDifEntropySrcModePtrng, kDifEntropySrcSingleBitMode2,
+                     true, true, 2, true, 2, 4},
+        ConfigParams{kDifEntropySrcModePtrng, kDifEntropySrcSingleBitMode3,
+                     true, true, 2, true, 3, 4}));
 
 class ReadTest : public DifEntropySrcTest {};
 
diff --git a/sw/device/lib/testing/entropy_testutils.c b/sw/device/lib/testing/entropy_testutils.c
index def6e5b..1d1939a 100644
--- a/sw/device/lib/testing/entropy_testutils.c
+++ b/sw/device/lib/testing/entropy_testutils.c
@@ -19,7 +19,7 @@
   CHECK_DIF_OK(dif_entropy_src_disable(&entropy_src));
 
   const dif_entropy_src_config_t config = {
-      .mode = kDifEntropySrcModeLfsr,
+      .mode = kDifEntropySrcModePtrng,
       .tests =
           {
               [kDifEntropySrcTestRepCount] = false,
@@ -33,8 +33,6 @@
       .reset_health_test_registers = false,
       .single_bit_mode = kDifEntropySrcSingleBitModeDisabled,
       .route_to_firmware = false,
-      .sample_rate = 2,
-      .lfsr_seed = 0,
   };
   CHECK_DIF_OK(dif_entropy_src_configure(&entropy_src, config));
 }
diff --git a/sw/device/tests/entropy_src_smoketest.c b/sw/device/tests/entropy_src_smoketest.c
index 089b390..55e6bdb 100644
--- a/sw/device/tests/entropy_src_smoketest.c
+++ b/sw/device/tests/entropy_src_smoketest.c
@@ -16,8 +16,8 @@
 const size_t kEntropyDataNumWords = 12;
 
 const uint32_t kExpectedEntropyData[] = {
-    0xa8f49c0d, 0x148ca619, 0xd1818b93, 0x25f2397d, 0x32955611, 0x0aca4b8e,
-    0xc0956655, 0x80735507, 0x4cf2b852, 0x97e50e09, 0x39649525, 0x6a2795f0,
+    0xdaf90306, 0x0466d674, 0x9691df54, 0xd2e3c93f, 0xdcbc993e, 0x64bfd173,
+    0xaba04e99, 0xf8ae1105, 0xd01dc17a, 0x608c5480, 0x373c5dcc, 0xc4e6cd55,
 };
 
 bool test_main() {
@@ -29,7 +29,7 @@
   CHECK_DIF_OK(dif_entropy_src_disable(&entropy_src));
 
   const dif_entropy_src_config_t config = {
-      .mode = kDifEntropySrcModeLfsr,
+      .mode = kDifEntropySrcModePtrng,
       .tests =
           {
               [kDifEntropySrcTestRepCount] = false,
@@ -42,10 +42,7 @@
       // this field needs to manually toggled by software.  Disable for now
       .reset_health_test_registers = false,
       .single_bit_mode = kDifEntropySrcSingleBitModeDisabled,
-      .route_to_firmware = true,
-      .sample_rate = 2,
-      .lfsr_seed = 2,
-  };
+      .route_to_firmware = true};
   CHECK_DIF_OK(dif_entropy_src_configure(&entropy_src, config));
 
   uint32_t entropy_data[kEntropyDataNumWords];