forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/arch/arm/mach-davinci/board-dm365-evm.c
....@@ -18,17 +18,20 @@
1818 #include <linux/i2c.h>
1919 #include <linux/io.h>
2020 #include <linux/clk.h>
21
-#include <linux/platform_data/at24.h>
21
+#include <linux/property.h>
2222 #include <linux/leds.h>
2323 #include <linux/mtd/mtd.h>
2424 #include <linux/mtd/partitions.h>
2525 #include <linux/slab.h>
2626 #include <linux/mtd/rawnand.h>
27
+#include <linux/nvmem-provider.h>
2728 #include <linux/input.h>
2829 #include <linux/spi/spi.h>
2930 #include <linux/spi/eeprom.h>
3031 #include <linux/v4l2-dv-timings.h>
3132 #include <linux/platform_data/ti-aemif.h>
33
+#include <linux/regulator/fixed.h>
34
+#include <linux/regulator/machine.h>
3235
3336 #include <asm/mach-types.h>
3437 #include <asm/mach/arch.h>
....@@ -143,7 +146,7 @@
143146 .mask_chipsel = BIT(14),
144147 .parts = davinci_nand_partitions,
145148 .nr_parts = ARRAY_SIZE(davinci_nand_partitions),
146
- .ecc_mode = NAND_ECC_HW,
149
+ .engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST,
147150 .bbt_options = NAND_BBT_USE_FLASH,
148151 .ecc_bits = 4,
149152 };
....@@ -203,18 +206,36 @@
203206 .num_resources = ARRAY_SIZE(davinci_aemif_resources),
204207 };
205208
206
-static struct at24_platform_data eeprom_info = {
207
- .byte_len = (256*1024) / 8,
208
- .page_size = 64,
209
- .flags = AT24_FLAG_ADDR16,
210
- .setup = davinci_get_mac_addr,
211
- .context = (void *)0x7f00,
209
+static struct nvmem_cell_info davinci_nvmem_cells[] = {
210
+ {
211
+ .name = "macaddr",
212
+ .offset = 0x7f00,
213
+ .bytes = ETH_ALEN,
214
+ }
215
+};
216
+
217
+static struct nvmem_cell_table davinci_nvmem_cell_table = {
218
+ .nvmem_name = "1-00500",
219
+ .cells = davinci_nvmem_cells,
220
+ .ncells = ARRAY_SIZE(davinci_nvmem_cells),
221
+};
222
+
223
+static struct nvmem_cell_lookup davinci_nvmem_cell_lookup = {
224
+ .nvmem_name = "1-00500",
225
+ .cell_name = "macaddr",
226
+ .dev_id = "davinci_emac.1",
227
+ .con_id = "mac-address",
228
+};
229
+
230
+static const struct property_entry eeprom_properties[] = {
231
+ PROPERTY_ENTRY_U32("pagesize", 64),
232
+ { }
212233 };
213234
214235 static struct i2c_board_info i2c_info[] = {
215236 {
216237 I2C_BOARD_INFO("24c256", 0x50),
217
- .platform_data = &eeprom_info,
238
+ .properties = eeprom_properties,
218239 },
219240 {
220241 I2C_BOARD_INFO("tlv320aic3x", 0x18),
....@@ -224,6 +245,19 @@
224245 static struct davinci_i2c_platform_data i2c_pdata = {
225246 .bus_freq = 400 /* kHz */,
226247 .bus_delay = 0 /* usec */,
248
+};
249
+
250
+/* Fixed regulator support */
251
+static struct regulator_consumer_supply fixed_supplies_3_3v[] = {
252
+ /* Baseboard 3.3V: 5V -> TPS767D301 -> 3.3V */
253
+ REGULATOR_SUPPLY("AVDD", "1-0018"),
254
+ REGULATOR_SUPPLY("DRVDD", "1-0018"),
255
+ REGULATOR_SUPPLY("IOVDD", "1-0018"),
256
+};
257
+
258
+static struct regulator_consumer_supply fixed_supplies_1_8v[] = {
259
+ /* Baseboard 1.8V: 5V -> TPS767D301 -> 1.8V */
260
+ REGULATOR_SUPPLY("DVDD", "1-0018"),
227261 };
228262
229263 static int dm365evm_keyscan_enable(struct device *dev)
....@@ -781,6 +815,14 @@
781815 if (ret)
782816 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
783817
818
+ regulator_register_always_on(0, "fixed-dummy", fixed_supplies_1_8v,
819
+ ARRAY_SIZE(fixed_supplies_1_8v), 1800000);
820
+ regulator_register_always_on(1, "fixed-dummy", fixed_supplies_3_3v,
821
+ ARRAY_SIZE(fixed_supplies_3_3v), 3300000);
822
+
823
+ nvmem_add_cell_table(&davinci_nvmem_cell_table);
824
+ nvmem_add_cell_lookups(&davinci_nvmem_cell_lookup, 1);
825
+
784826 evm_init_i2c();
785827 davinci_serial_init(dm365_serial_device);
786828
....@@ -794,9 +836,9 @@
794836 /* maybe setup mmc1/etc ... _after_ mmc0 */
795837 evm_init_cpld();
796838
797
-#ifdef CONFIG_SND_DM365_AIC3X_CODEC
839
+#ifdef CONFIG_SND_SOC_DM365_AIC3X_CODEC
798840 dm365_init_asp();
799
-#elif defined(CONFIG_SND_DM365_VOICE_CODEC)
841
+#elif defined(CONFIG_SND_SOC_DM365_VOICE_CODEC)
800842 dm365_init_vc();
801843 #endif
802844 dm365_init_rtc();
....@@ -809,7 +851,7 @@
809851 MACHINE_START(DAVINCI_DM365_EVM, "DaVinci DM365 EVM")
810852 .atag_offset = 0x100,
811853 .map_io = dm365_evm_map_io,
812
- .init_irq = davinci_irq_init,
854
+ .init_irq = dm365_init_irq,
813855 .init_time = dm365_init_time,
814856 .init_machine = dm365_evm_init,
815857 .init_late = davinci_init_late,