Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/nvidia add external function for writing to dvc...
details: https://anonhg.NetBSD.org/src/rev/d3ee5d0759d5
branches: trunk
changeset: 338596:d3ee5d0759d5
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun May 31 14:41:59 2015 +0000
description:
add external function for writing to dvc (I2C5) devices
diffstat:
sys/arch/arm/nvidia/tegra_i2c.c | 21 +++++++++++++++++++--
sys/arch/arm/nvidia/tegra_var.h | 4 +++-
2 files changed, 22 insertions(+), 3 deletions(-)
diffs (57 lines):
diff -r 8824c626ed28 -r d3ee5d0759d5 sys/arch/arm/nvidia/tegra_i2c.c
--- a/sys/arch/arm/nvidia/tegra_i2c.c Sun May 31 10:50:04 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_i2c.c Sun May 31 14:41:59 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_i2c.c,v 1.4 2015/05/17 01:26:22 jmcneill Exp $ */
+/* $NetBSD: tegra_i2c.c,v 1.5 2015/05/31 14:41:59 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
#include "locators.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_i2c.c,v 1.4 2015/05/17 01:26:22 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_i2c.c,v 1.5 2015/05/31 14:41:59 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -418,3 +418,20 @@
return tegra_i2c_wait(sc, flags);
}
+
+void
+tegra_i2c_dvc_write(uint8_t addr, uint32_t data, size_t datalen)
+{
+ bus_space_tag_t bst = &armv7_generic_bs_tag;
+ bus_space_handle_t bsh;
+
+ bus_space_subregion(bst, tegra_apb_bsh, TEGRA_I2C5_OFFSET,
+ TEGRA_I2C5_SIZE, &bsh);
+
+ bus_space_write_4(bst, bsh, I2C_CMD_ADDR0_REG, addr << 1);
+ bus_space_write_4(bst, bsh, I2C_CMD_DATA1_REG, data);
+ bus_space_write_4(bst, bsh, I2C_CNFG_REG,
+ __SHIFTIN(datalen - 1, I2C_CNFG_LENGTH) |
+ I2C_CNFG_NEW_MASTER_FSM |
+ I2C_CNFG_SEND);
+}
diff -r 8824c626ed28 -r d3ee5d0759d5 sys/arch/arm/nvidia/tegra_var.h
--- a/sys/arch/arm/nvidia/tegra_var.h Sun May 31 10:50:04 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_var.h Sun May 31 14:41:59 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_var.h,v 1.20 2015/05/30 13:25:55 jmcneill Exp $ */
+/* $NetBSD: tegra_var.h,v 1.21 2015/05/31 14:41:59 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -140,6 +140,8 @@
void tegra_pmc_remove_clamping(u_int);
void tegra_pmc_hdmi_enable(void);
+void tegra_i2c_dvc_write(uint8_t, uint32_t, size_t);
+
psize_t tegra_mc_memsize(void);
void tegra_xusbpad_sata_enable(void);
Home |
Main Index |
Thread Index |
Old Index