first and last commit

This commit is contained in:
Chris Nutter committed 2023-07-08 13:03:17 -07:00
commit 1bf4efd552
2612 files changed
+636500

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* This document is the property of Apple Inc.
* It is considered confidential and proprietary.
*
* This document may not be reproduced or transmitted in any form,
* in whole or in part, without the express written permission of
* Apple Inc.
*/
#include <debug.h>
#include <platform.h>
#include <platform/clocks.h>
#include <platform/soc/hwclocks.h>
#include "dwi.h"
#ifndef TARGET_DWI_FREQUENCY
#error TARGET_DWI_FREQUENCY not defined by the target
#endif
#ifndef TARGET_DWI_TRANSFER_GAP_US
#error TARGET_DWI_TRANSFER_GAP_US not defined by the target
#endif
int dwi_init(void)
{
u_int32_t dwi_divider, dwi_transfer_gap;
clock_gate(CLK_DWI, true);
dwi_divider = (clock_get_frequency(CLK_NCLK) + TARGET_DWI_FREQUENCY - 1) / TARGET_DWI_FREQUENCY;
dwi_transfer_gap = (clock_get_frequency(CLK_NCLK) * TARGET_DWI_TRANSFER_GAP_US) / 1000000;
rDWI_CLOCK_CONFIG = DWI_CLOCK_CONFIG_CLOCK_SCALER(dwi_divider) | DWI_CLOCK_CONFIG_TX_CPHA_1;
rDWI_TRANSFER_GAP = dwi_transfer_gap;
return 0;
}
int dwi_send_backlight_command(uint32_t backlight_command, uint32_t backlight_level)
{
rDWI_ITR0_TX_DATA = (backlight_command << 28) | (backlight_level & 0x7FF);
rDWI_ITR0_CONTROL = DWI_TR_CTRL_BYTE_SWAP | DWI_TR_CTRL_BYTE_CNT(4) | DWI_TR_CTRL_TRAN_EN | DWI_TR_CTRL_SLAVE_DWI;
return 0;
}
+36
View File
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2014-2015 Apple Inc. All rights reserved.
*
* This document is the property of Apple Inc.
* It is considered confidential and proprietary.
*
* This document may not be reproduced or transmitted in any form,
* in whole or in part, without the express written permission of
* Apple Inc.
*/
#ifndef __APPLE_DWI_H
#define __APPLE_DWI_H
#include <platform/soc/hwregbase.h>
#include SUB_PLATFORM_SPDS_HEADER(dwi)
#define rDWI_CLOCK_CONFIG (*(volatile u_int32_t *)(DWI_BASE_ADDR + DWI_BLK_CLOCK_CONFIG_OFFSET))
#define DWI_CLOCK_CONFIG_TX_CPHA_1 (DWI_BLK_CLOCK_CONFIG_TX_CPHA_INSRT(1) << 0)
#define DWI_CLOCK_CONFIG_TX_CPHA_2 (DWI_BLK_CLOCK_CONFIG_TX_CPHA_INSRT(0) << 0)
#define DWI_CLOCK_CONFIG_RX_CPHA_1 (DWI_BLK_CLOCK_CONFIG_TX_CPHA_INSRT(1) << 1)
#define DWI_CLOCK_CONFIG_RX_CPHA_2 (DWI_BLK_CLOCK_CONFIG_TX_CPHA_INSRT(0) << 1)
#define DWI_CLOCK_CONFIG_CPOL_LOW (DWI_BLK_CLOCK_CONFIG_CPOL_INSRT(0) << 2)
#define DWI_CLOCK_CONFIG_CPOL_HIGH (DWI_BLK_CLOCK_CONFIG_CPOL_INSRT(1) << 2)
#define DWI_CLOCK_CONFIG_CLOCK_SCALER(_x) (DWI_BLK_CLOCK_CONFIG_CLOCK_SCALER_INSRT(_x - 1))
#define rDWI_TRANSFER_GAP (*(volatile u_int32_t *)(DWI_BASE_ADDR + DWI_BLK_TRANSFER_GAP_OFFSET))
#define rDWI_ITR0_CONTROL (*(volatile u_int32_t *)(DWI_BASE_ADDR + DWI_BLK_ITR0_CONTROL_OFFSET))
#define DWI_TR_CTRL_TRAN_EN (1 << DWI_BLK_ITR0_CONTROL_ITR0_TRAN_EN_SHIFT)
#define DWI_TR_CTRL_BYTE_CNT(_c) (DWI_BLK_ITR0_CONTROL_ITR0_BYTE_COUNT_INSRT(_c - 1))
#define DWI_TR_CTRL_BYTE_SWAP (1 << DWI_BLK_ITR0_CONTROL_ITR0_BYTE_SWAP_SHIFT)
#define DWI_TR_CTRL_BIT_ORDER (1 << DWI_BLK_ITR0_CONTROL_ITR0_BIT_ORDER_SHIFT)
#define DWI_TR_CTRL_SLAVE_PSPI (DWI_BLK_ITR0_CONTROL_SLAVE_SEL_INSRT(0))
#define DWI_TR_CTRL_SLAVE_DWI (DWI_BLK_ITR0_CONTROL_SLAVE_SEL_INSRT(1))
#define rDWI_ITR0_TX_DATA (*(volatile u_int32_t *)(DWI_BASE_ADDR + DWI_BLK_ITR0_TX_DATA_OFFSET))
#endif /* ! __APPLE_DWI_H */
+15
View File
@@ -0,0 +1,15 @@
# Copyright (C) 2011 Apple Inc. All rights reserved.
#
# This document is the property of Apple Inc.
# It is considered confidential and proprietary.
#
# This document may not be reproduced or transmitted in any form,
# in whole or in part, without the express written permission of
# Apple Inc.
#
LOCAL_DIR := $(GET_LOCAL_DIR)
OPTIONS += \
WITH_HW_DWI=1
ALL_OBJS += $(LOCAL_DIR)/dwi.o