From 670941cedc2752b0ab8bde3eabb669f01ae60ee6 Mon Sep 17 00:00:00 2001 From: zhaoxc0502 Date: Sun, 26 Dec 2021 01:09:10 +0800 Subject: [PATCH 1/2] merge vim3l content Signed-off-by: zhaoxc0502 --- Kconfig | 4 +- Makefile | 7 + model/audio/Kconfig | 2 +- model/audio/Makefile | 59 +++- model/input/Makefile | 2 + model/usb/device/Kconfig | 2 +- model/usb/device/f_generic.c | 1 + network/Makefile | 2 +- network/include/net_device_adapter.h | 7 +- network/src/Makefile | 5 +- osal/src/osal_mem.c | 21 +- osal/src/osal_mutex.c | 17 +- osal/src/osal_thread.c | 2 +- platform/emmc/emmc_adapter.c | 87 +++--- platform/mipi_dsi/Makefile | 3 +- platform/mipi_dsi/mipi_tx_dev.c | 8 +- platform/mipi_dsi/mipi_tx_hi35xx.c | 11 +- platform/pwm/pwm_adapter.c | 16 +- platform/pwm/pwm_hi35xx.h | 6 +- platform/pwm/pwm_hi35xx_linux.c | 40 +-- platform/rtc/rtc_adapter.c | 2 +- platform/sdio/sdio_adapter.c | 283 +++++++++--------- platform/spi/Makefile | 2 +- .../{hi35xx_spi_adapter.c => spi_adapter.c} | 15 +- platform/uart/uart_adapter.c | 2 +- platform/watchdog/watchdog_adapter.c | 2 +- 26 files changed, 333 insertions(+), 275 deletions(-) rename platform/spi/{hi35xx_spi_adapter.c => spi_adapter.c} (98%) diff --git a/Kconfig b/Kconfig index 037b190..c646dec 100644 --- a/Kconfig +++ b/Kconfig @@ -25,4 +25,6 @@ source "drivers/hdf/khdf/model/usb/host/Kconfig" source "drivers/hdf/khdf/model/usb/device/Kconfig" source "drivers/hdf/khdf/model/audio/Kconfig" source "drivers/hdf/khdf/model/misc/vibrator/Kconfig" -source "drivers/hdf/khdf/model/misc/dsoftbus/Kconfig" \ No newline at end of file +source "drivers/hdf/khdf/model/misc/dsoftbus/Kconfig" +source "../../../../../device/amlogic/drivers/ethernet/adapter/Kconfig" +source "drivers/hdf/framework/model/input/driver/touchscreen/Kconfig" diff --git a/Makefile b/Makefile index 33c8c23..5f517cc 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ # export HDF_ROOT := drivers/hdf +export PRODUCT_PATH := /vendor/amlogic/vim3l obj-$(CONFIG_DRIVERS_HDF) += osal/ obj-$(CONFIG_DRIVERS_HDF) += network/ obj-$(CONFIG_DRIVERS_HDF) += config/ @@ -51,3 +52,9 @@ obj-$(CONFIG_DRIVERS_HDF_BT) += model/network/bluetooth/ obj-$(CONFIG_DRIVERS_HDF_VIBRATOR) += model/misc/vibrator/ obj-$(CONFIG_DRIVERS_HDF_AUDIO) += model/audio/ obj-$(CONFIG_DRIVERS_HDF_DSOFTBUS) += model/misc/dsoftbus/ +# ThunderSoft for OpenHarmony start +obj-y += network/ +obj-$(CONFIG_DRIVERS_HDF_VIM3L_ETHERNET) += ../../../../device/amlogic/drivers/ethernet/adapter/ +ccflags-$(CONFIG_DRIVERS_HDF_VIM3L_ETHERNET) += -Idrivers/net/ethernet/stmicro/stmmac/ +# ThunderSoft for OpenHarmony end +obj-$(CONFIG_DRIVERS_HDF_WIFI) += ../../../../device/amlogic/drivers/wifi/ap6212/ diff --git a/model/audio/Kconfig b/model/audio/Kconfig index a760df7..e640397 100755 --- a/model/audio/Kconfig +++ b/model/audio/Kconfig @@ -1,6 +1,6 @@ config DRIVERS_HDF_AUDIO bool "Enable HDF Audio driver" - default y + default n depends on DRIVERS_HDF help Answer Y to choice HDF Audio input driver. diff --git a/model/audio/Makefile b/model/audio/Makefile index f6eeeb8..8aee277 100755 --- a/model/audio/Makefile +++ b/model/audio/Makefile @@ -29,16 +29,46 @@ obj-y += \ $(KHDF_AUDIO_ROOT_DIR)/sapm/src/audio_sapm.o \ $(KHDF_AUDIO_ROOT_DIR)/dispatch/src/audio_stream_dispatch.o \ $(KHDF_AUDIO_ROOT_DIR)/dispatch/src/audio_control_dispatch.o \ - $(KHDF_AUDIO_CODEC_DIR)/tfa9879/accessory/src/tfa9879_accessory_adapter.o \ - $(KHDF_AUDIO_CODEC_DIR)/tfa9879/accessory/src/tfa9879_accessory_impl.o \ - $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/codec/src/hi3516_codec_adapter.o \ - $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/codec/src/hi3516_codec_impl.o \ - $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/codec/src/hi3516_codec_ops.o \ - $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/dsp/src/dsp_adapter.o \ - $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_dai_adapter.o \ - $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_aiao_impl.o \ - $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_platform_ops.o \ - $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_platform_adapter.o + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/amlogic_dai_driver.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/amlogic_platform_driver.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/audio_controller.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/audio_io.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/audio_clks.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/axg,clocks.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/g12a,clocks.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/tl1,clocks.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/sm1,clocks.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/tm2,clocks.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/card_utils.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/tdm_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/spdif.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/spdif_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/iomap.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/pdm.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/pdm_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/ddr_mngr.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/loopback.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/loopback_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/audio_utils.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/locker.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/locker_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/resample.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/resample_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/effects.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/effects_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/effects_v2.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/effects_hw_v2.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/pwrdet.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/pwrdet_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/sharebuffer.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/extn.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/frhdmirx_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/vad.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/vad_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/vad_dev.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/earc.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/earc_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/dummy_codec/dummy_codec_adapter.o obj-$(CONFIG_ARCH_HI3516DV300) += \ $(KHDF_AUDIO_ROOT_DIR)/core/src/audio_core.o \ @@ -61,7 +91,7 @@ obj-$(CONFIG_ARCH_HI3516DV300) += \ $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_platform_ops.o \ $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_platform_adapter.o -ccflags-y += -lm -lc -lgcc -std=gnu99 -Werror \ +ccflags-y += -lm -lc -lgcc -std=gnu99 \ -Iinclude/$(KHDF_AUDIO_BASE_ROOT_DIR)/drivers/framework/include/platform \ -Iinclude/$(KHDF_AUDIO_BASE_ROOT_DIR)/utils/native/base/include \ -Iinclude/$(KHDF_AUDIO_KHDF_ROOT_DIR)/osal/include \ @@ -83,9 +113,8 @@ ccflags-y += -lm -lc -lgcc -std=gnu99 -Werror \ -Iinclude/$(KHDF_FRAMEWORK_ROOT_DIR)/model/audio/sapm/include \ -Iinclude/$(KHDF_FRAMEWORK_ROOT_DIR)/model/audio/dispatch/include \ -Iinclude/$(KHDF_FRAMEWORK_ROOT_DIR)/model/audio/common/include \ - -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/tfa9879/accessory/include \ - -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/codec/include \ - -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/include \ - -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/include \ + -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/amlogic/include \ + -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/include \ + -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter \ -Iinclude/$(KHDF_AUDIO_PERIPHERAL_ROOT_DIR)/audio/interfaces/include \ -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/include diff --git a/model/input/Makefile b/model/input/Makefile index 024bc5e..f34a9ac 100644 --- a/model/input/Makefile +++ b/model/input/Makefile @@ -25,6 +25,8 @@ obj-$(CONFIG_DRIVERS_HDF_INPUT) += \ obj-$(CONFIG_DRIVERS_HDF_TP_5P5_GT911) += \ $(INPUT_ROOT_DIR)/touchscreen/touch_gt911.o +obj-$(CONFIG_ARCH_VIM3L_TOUCH) += \ + $(INPUT_ROOT_DIR)/touchscreen/touch_ft5336.o obj-$(CONFIG_DRIVERS_HDF_TP_2P35_FT6236) += \ $(INPUT_ROOT_DIR)/touchscreen/touch_ft6336.o diff --git a/model/usb/device/Kconfig b/model/usb/device/Kconfig index 54d4cc7..eb473b3 100644 --- a/model/usb/device/Kconfig +++ b/model/usb/device/Kconfig @@ -1,6 +1,6 @@ config DRIVERS_HDF_USB_F_GENERIC bool "Enable F_GENERIC driver" - default y + default n depends on DRIVERS_HDF help Answer Y to choice HDF USB F_GENERIC driver. diff --git a/model/usb/device/f_generic.c b/model/usb/device/f_generic.c index 6878c95..1d9bde5 100644 --- a/model/usb/device/f_generic.c +++ b/model/usb/device/f_generic.c @@ -28,6 +28,7 @@ #include "u_f.h" #include "u_os_desc.h" #include "configfs.h" +#include "linux/swait.h" #define FUNCTIONFS_MAGIC 0xa647361 /* Chosen by a honest dice roll ;) */ diff --git a/network/Makefile b/network/Makefile index e6891c5..93b3a29 100644 --- a/network/Makefile +++ b/network/Makefile @@ -12,4 +12,4 @@ # # -obj-$(CONFIG_DRIVERS_HDF_WIFI) += src/ \ No newline at end of file +obj-y += src/ diff --git a/network/include/net_device_adapter.h b/network/include/net_device_adapter.h index f124752..1714aff 100755 --- a/network/include/net_device_adapter.h +++ b/network/include/net_device_adapter.h @@ -22,15 +22,14 @@ #include #include -#include "net_device_impl.h" - /** * data sending results, just define locked here, ok and busy reference linux definition for enum netdev_tx. */ #define NETDEV_TX_LOCKED 0x20 -int32_t RegisterNetDeviceImpl(struct NetDeviceImpl *ndImpl); -int32_t UnRegisterNetDeviceImpl(struct NetDeviceImpl *ndImpl); +// int32_t RegisterNetDeviceImpl(struct NetDeviceImpl *ndImpl); +// int32_t UnRegisterNetDeviceImpl(struct NetDeviceImpl *ndImpl); +struct net_device *GetKernelDev(void); struct FullNetDevicePriv { struct net_device *dev; diff --git a/network/src/Makefile b/network/src/Makefile index 34d25ae..f74b9b8 100755 --- a/network/src/Makefile +++ b/network/src/Makefile @@ -12,9 +12,9 @@ # # -obj-$(CONFIG_DRIVERS_HDF_WIFI) += net_device_adapter.o netbuf_adapter.o +obj-y += net_device_adapter.o netbuf_adapter.o -ccflags-$(CONFIG_DRIVERS_HDF_WIFI) += \ +ccflags-y += \ -Idrivers/hdf/framework/model/network/common/netdevice \ -Idrivers/hdf/framework/include/net\ -Idrivers/hdf/khdf/network/include \ @@ -23,3 +23,4 @@ ccflags-$(CONFIG_DRIVERS_HDF_WIFI) += \ -Iinclude/hdf/utils \ -Iinclude/hdf/osal \ -I$(PROJECT_ROOT)/third_party/bounds_checking_function/include +ccflags-$(CONFIG_DRIVERS_HDF_VIM3L_ETHERNET) += -Idrivers/net/ethernet/stmicro/stmmac/ \ No newline at end of file diff --git a/osal/src/osal_mem.c b/osal/src/osal_mem.c index 22024ab..b511a18 100644 --- a/osal/src/osal_mem.c +++ b/osal/src/osal_mem.c @@ -54,13 +54,20 @@ static void *osal_mem_alloc(size_t size, uint32_t *type) if (size > (KMALLOC_SIZE - mng_size)) { base = (char *)vmalloc(size + mng_size); - *type = TYPE_VMALLOC; - } else { - base = (char *)kmalloc(size + mng_size, GFP_KERNEL); - *type = TYPE_KMALLOC; - } - - return base; + *type = TYPE_VMALLOC; + } else { + base = (char *)kmalloc(size + mng_size, GFP_NOWAIT); + if (base == NULL) { + HDF_LOGE("cannot allocate memory by no wait!\n"); + base = (char *)kmalloc(size + mng_size, GFP_ATOMIC); + if (base == NULL) { + HDF_LOGE("cannot allocate memory by atomic!\n"); + } + } + *type = TYPE_KMALLOC; + } + + return base; } void *OsalMemAlloc(size_t size) diff --git a/osal/src/osal_mutex.c b/osal/src/osal_mutex.c index 1809540..bf41e6b 100644 --- a/osal/src/osal_mutex.c +++ b/osal/src/osal_mutex.c @@ -73,10 +73,23 @@ int32_t OsalMutexLock(struct OsalMutex *mutex) } EXPORT_SYMBOL(OsalMutexLock); +int32_t OsalMutexTryLock(struct OsalMutex *mutex) +{ + int32_t retVal = 0; + if (mutex == NULL || mutex->realMutex == NULL) { + HDF_LOGE("%s invalid param", __func__); + return HDF_ERR_INVALID_PARAM; + } + + retVal = mutex_trylock((struct mutex *)mutex->realMutex); + return HDF_SUCCESS; +} +EXPORT_SYMBOL(OsalMutexTryLock); + int32_t OsalMutexTimedLock(struct OsalMutex *mutex, uint32_t mSec) { - if (mutex == NULL || mutex->realMutex == NULL) { - HDF_LOGE("%s invalid param", __func__); + if (mutex == NULL || mutex->realMutex == NULL) { + HDF_LOGE("%s invalid param", __func__); return HDF_ERR_INVALID_PARAM; } diff --git a/osal/src/osal_thread.c b/osal/src/osal_thread.c index b2fb28d..343a8e4 100644 --- a/osal/src/osal_thread.c +++ b/osal/src/osal_thread.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "hdf_log.h" #include "osal_mem.h" #include "securec.h" diff --git a/platform/emmc/emmc_adapter.c b/platform/emmc/emmc_adapter.c index 449cab0..7c4799a 100644 --- a/platform/emmc/emmc_adapter.c +++ b/platform/emmc/emmc_adapter.c @@ -1,7 +1,7 @@ /* * emmc_adapter.c * - * hi35xx linux emmc driver implement. + * linux emmc driver implement. * * Copyright (c) 2020-2021 Huawei Device Co., Ltd. * @@ -27,45 +27,45 @@ #define HDF_LOG_TAG emmc_adapter_c -struct mmc_host *himci_get_mmc_host(int slot); +struct mmc_host *meson_get_mmc_host(int slot); -int32_t Hi35xxLinuxEmmcGetCid(struct EmmcDevice *dev, uint8_t *cid, uint32_t size) +int32_t LinuxEmmcGetCid(struct EmmcDevice *dev, uint8_t *cid, uint32_t size) { struct mmc_host *mmcHost = NULL; struct MmcCntlr *cntlr = NULL; if (dev == NULL || dev->mmc.cntlr == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcGetCid: dev or cntlr is null."); + HDF_LOGE("LinuxEmmcGetCid: dev or cntlr is null."); return HDF_ERR_INVALID_OBJECT; } if (cid == NULL || size < EMMC_CID_LEN) { - HDF_LOGE("Hi35xxLinuxEmmcGetCid: cid is null or size is invalid."); + HDF_LOGE("LinuxEmmcGetCid: cid is null or size is invalid."); return HDF_ERR_INVALID_PARAM; } cntlr = dev->mmc.cntlr; mmcHost = (struct mmc_host *)cntlr->priv; if (mmcHost == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcGetCid: mmcHost is NULL!"); + HDF_LOGE("LinuxEmmcGetCid: mmcHost is NULL!"); return HDF_ERR_NOT_SUPPORT; } if (mmcHost->card == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcGetCid: card is null."); + HDF_LOGE("LinuxEmmcGetCid: card is null."); return HDF_ERR_NOT_SUPPORT; } if (memcpy_s(cid, sizeof(uint8_t) * size, (uint8_t *)(mmcHost->card->raw_cid), sizeof(mmcHost->card->raw_cid)) != EOK) { - HDF_LOGE("Hi35xxLinuxEmmcGetCid: memcpy_s fail!"); + HDF_LOGE("LinuxEmmcGetCid: memcpy_s fail!"); return HDF_FAILURE; } return HDF_SUCCESS; } static struct EmmcDeviceOps g_emmcMethod = { - .getCid = Hi35xxLinuxEmmcGetCid, + .getCid = LinuxEmmcGetCid, }; -static void Hi35xxLinuxEmmcDeleteCntlr(struct MmcCntlr *cntlr) +static void LinuxEmmcDeleteCntlr(struct MmcCntlr *cntlr) { if (cntlr == NULL) { return; @@ -79,110 +79,111 @@ static void Hi35xxLinuxEmmcDeleteCntlr(struct MmcCntlr *cntlr) OsalMemFree(cntlr); } -static int32_t Hi35xxLinuxEmmcCntlrParse(struct MmcCntlr *cntlr, struct HdfDeviceObject *obj) +static int32_t LinuxEmmcCntlrParse(struct MmcCntlr *cntlr, struct HdfDeviceObject *obj) { const struct DeviceResourceNode *node = NULL; struct DeviceResourceIface *drsOps = NULL; int32_t ret; if (obj == NULL || cntlr == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcCntlrParse: input para is NULL."); + HDF_LOGE("LinuxEmmcCntlrParse: input para is NULL."); return HDF_FAILURE; } node = obj->property; if (node == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcCntlrParse: drs node is NULL."); + HDF_LOGE("LinuxEmmcCntlrParse: drs node is NULL."); return HDF_FAILURE; } drsOps = DeviceResourceGetIfaceInstance(HDF_CONFIG_SOURCE); if (drsOps == NULL || drsOps->GetUint16 == NULL || drsOps->GetUint32 == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcCntlrParse: invalid drs ops fail!"); + HDF_LOGE("LinuxEmmcCntlrParse: invalid drs ops fail!"); return HDF_FAILURE; } ret = drsOps->GetUint16(node, "hostId", &(cntlr->index), 0); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxEmmcCntlrParse: read hostIndex fail!"); + HDF_LOGE("LinuxEmmcCntlrParse: read hostIndex fail!"); return ret; } ret = drsOps->GetUint32(node, "devType", &(cntlr->devType), 0); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxEmmcCntlrParse: read devType fail!"); + HDF_LOGE("LinuxEmmcCntlrParse: read devType fail!"); return ret; } return HDF_SUCCESS; } -static int32_t Hi35xxLinuxEmmcBind(struct HdfDeviceObject *obj) +static int32_t LinuxEmmcBind(struct HdfDeviceObject *obj) { struct MmcCntlr *cntlr = NULL; int32_t ret; - HDF_LOGE("Hi35xxLinuxEmmcBind: entry!"); + HDF_LOGE("LinuxEmmcBind: entry!"); if (obj == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcBind: Fail, obj is NULL."); + HDF_LOGE("LinuxEmmcBind: Fail, obj is NULL."); return HDF_ERR_INVALID_OBJECT; } cntlr = (struct MmcCntlr *)OsalMemCalloc(sizeof(struct MmcCntlr)); if (cntlr == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcBind: no mem for MmcCntlr."); + HDF_LOGE("LinuxEmmcBind: no mem for MmcCntlr."); return HDF_ERR_MALLOC_FAIL; } cntlr->ops = NULL; cntlr->hdfDevObj = obj; obj->service = &cntlr->service; - ret = Hi35xxLinuxEmmcCntlrParse(cntlr, obj); + ret = LinuxEmmcCntlrParse(cntlr, obj); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxEmmcBind: cntlr parse fail."); - goto _ERR; + HDF_LOGE("LinuxEmmcBind: cntlr parse fail."); + LinuxEmmcDeleteCntlr(cntlr); + HDF_LOGE("LinuxEmmcBind: Fail!"); + return HDF_FAILURE; } - cntlr->priv = (void *)himci_get_mmc_host((int32_t)cntlr->index); + cntlr->priv = (void *)meson_get_mmc_host((int32_t)cntlr->index); ret = MmcCntlrAdd(cntlr); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxEmmcBind: cntlr add fail."); - goto _ERR; + HDF_LOGE("LinuxEmmcBind: cntlr add fail."); + LinuxEmmcDeleteCntlr(cntlr); + HDF_LOGE("LinuxEmmcBind: Fail!"); + return HDF_FAILURE; } ret = MmcCntlrAllocDev(cntlr, (enum MmcDevType)cntlr->devType); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxEmmcBind: alloc dev fail."); - goto _ERR; + HDF_LOGE("LinuxEmmcBind: alloc dev fail."); + LinuxEmmcDeleteCntlr(cntlr); + HDF_LOGE("LinuxEmmcBind: Fail!"); + return HDF_FAILURE; } MmcDeviceAddOps(cntlr->curDev, &g_emmcMethod); - HDF_LOGD("Hi35xxLinuxEmmcBind: Success!"); + HDF_LOGD("LinuxEmmcBind: Success!"); return HDF_SUCCESS; - -_ERR: - Hi35xxLinuxEmmcDeleteCntlr(cntlr); - HDF_LOGE("Hi35xxLinuxEmmcBind: Fail!"); - return HDF_FAILURE; } -static int32_t Hi35xxLinuxEmmcInit(struct HdfDeviceObject *obj) +static int32_t LinuxEmmcInit(struct HdfDeviceObject *obj) { (void)obj; - HDF_LOGD("Hi35xxLinuxEmmcInit: Success!"); + HDF_LOGD("LinuxEmmcInit: Success!"); return HDF_SUCCESS; } -static void Hi35xxLinuxEmmcRelease(struct HdfDeviceObject *obj) +static void LinuxEmmcRelease(struct HdfDeviceObject *obj) { if (obj == NULL) { return; } - Hi35xxLinuxEmmcDeleteCntlr((struct MmcCntlr *)obj->service); + LinuxEmmcDeleteCntlr((struct MmcCntlr *)obj->service); } -struct HdfDriverEntry g_emmcDriverEntry = { +struct HdfDriverEntry g_emmcdriverentry = { .moduleVersion = 1, - .Bind = Hi35xxLinuxEmmcBind, - .Init = Hi35xxLinuxEmmcInit, - .Release = Hi35xxLinuxEmmcRelease, + .Bind = LinuxEmmcBind, + .Init = LinuxEmmcInit, + .Release = LinuxEmmcRelease, .moduleName = "HDF_PLATFORM_EMMC", }; -HDF_INIT(g_emmcDriverEntry); +HDF_INIT(g_emmcdriverentry); diff --git a/platform/mipi_dsi/Makefile b/platform/mipi_dsi/Makefile index 82728cc..909edb1 100644 --- a/platform/mipi_dsi/Makefile +++ b/platform/mipi_dsi/Makefile @@ -18,7 +18,6 @@ obj-y += $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/mipi_dsi_core.o \ $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/mipi_dsi_if.o \ mipi_dsi_adapter.o -obj-y += mipi_tx_dev.o \ - mipi_tx_hi35xx.o +obj-y += mipi_tx_dev.o EXTRA_CFLAGS += -Wno-error=date-time diff --git a/platform/mipi_dsi/mipi_tx_dev.c b/platform/mipi_dsi/mipi_tx_dev.c index ce49737..a7e6503 100644 --- a/platform/mipi_dsi/mipi_tx_dev.c +++ b/platform/mipi_dsi/mipi_tx_dev.c @@ -328,7 +328,7 @@ static int32_t MipiDsiDevSetCfg(struct MipiDsiCntlr *cntlr, struct MipiCfg *arg) } if (access_ok( -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) VERIFY_READ, #endif arg, size)) { /* user space */ @@ -378,7 +378,7 @@ int32_t MipiDsiDevSetCmd(struct MipiDsiCntlr *cntlr, struct DsiCmdDesc *arg) } if (access_ok( -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) VERIFY_READ, #endif arg, size)) { /* user space */ @@ -420,7 +420,7 @@ int32_t MipiDsiDevGetCmd(struct MipiDsiCntlr *cntlr, GetDsiCmdDescTag *arg) return HDF_ERR_MALLOC_FAIL; } if (access_ok( -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) VERIFY_READ, #endif arg, size)) { /* user space */ @@ -440,7 +440,7 @@ int32_t MipiDsiDevGetCmd(struct MipiDsiCntlr *cntlr, GetDsiCmdDescTag *arg) goto fail0; } if (access_ok( -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) VERIFY_WRITE, #endif arg, size)) { /* user space */ diff --git a/platform/mipi_dsi/mipi_tx_hi35xx.c b/platform/mipi_dsi/mipi_tx_hi35xx.c index 0c43806..2987ff6 100644 --- a/platform/mipi_dsi/mipi_tx_hi35xx.c +++ b/platform/mipi_dsi/mipi_tx_hi35xx.c @@ -690,7 +690,7 @@ static int32_t LinuxCopyToKernel(void *dest, uint32_t max, const void *src, uint int32_t ret; if (access_ok( -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) VERIFY_READ, #endif src, count)) { /* user space */ @@ -704,6 +704,7 @@ static int32_t LinuxCopyToKernel(void *dest, uint32_t max, const void *src, uint HDF_LOGE("%s: [memcpy_s] failed.", __func__); } } + HDF_LOGI("%s: success.", __func__); return ret; } @@ -755,6 +756,7 @@ static int MipiTxDrvSetCmdInfo(const CmdInfoTag *cmdInfo) HDF_LOGE("%s: [MipiTxWaitWriteFifoEmpty] failed.", __func__); return HDF_FAILURE; } + HDF_LOGI("%s: cmdSize = 0x%x, dataType = 0x%x", __func__, cmdInfo->cmdSize, cmdInfo->dataType); return HDF_SUCCESS; } @@ -876,6 +878,7 @@ static void MipiTxReset(void) static int MipiTxDrvGetCmdInfo(GetCmdInfoTag *getCmdInfo) { unsigned char *dataBuf = NULL; + HDF_LOGI("%s: enter!", __func__); dataBuf = (unsigned char*)OsalMemAlloc(getCmdInfo->getDataSize); if (dataBuf == NULL) { @@ -897,7 +900,7 @@ static int MipiTxDrvGetCmdInfo(GetCmdInfoTag *getCmdInfo) goto fail0; } if (access_ok( -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) VERIFY_WRITE, #endif getCmdInfo->getData, getCmdInfo->getDataSize)) { /* user space */ @@ -913,6 +916,7 @@ static int MipiTxDrvGetCmdInfo(GetCmdInfoTag *getCmdInfo) } OsalMemFree(dataBuf); dataBuf = NULL; + HDF_LOGI("%s: success!", __func__); return HDF_SUCCESS; fail0: @@ -1080,6 +1084,7 @@ static int MipiTxCheckCombDevCfg(const ComboDevCfgTag *devCfg) return HDF_FAILURE; } + HDF_LOGI("%s: success!", __func__); return HDF_SUCCESS; } @@ -1225,6 +1230,7 @@ static int MipiTxGetCmd(GetCmdInfoTag *getCmdInfo) static int32_t Hi35xxGetCmd(struct MipiDsiCntlr *cntlr, struct DsiCmdDesc *cmd, uint32_t readLen, uint8_t *out) { GetCmdInfoTag cmdInfo; + HDF_LOGI("%s: enter!", __func__); (void)cntlr; if (cmd == NULL || out == NULL) { @@ -1271,6 +1277,7 @@ static struct MipiDsiCntlrMethod g_method = { static int32_t Hi35xxMipiTxInit(struct HdfDeviceObject *device) { int32_t ret; + HDF_LOGI("%s: enter!", __func__); g_mipiTx.priv = NULL; g_mipiTx.ops = &g_method; diff --git a/platform/pwm/pwm_adapter.c b/platform/pwm/pwm_adapter.c index 504f782..e94cb71 100644 --- a/platform/pwm/pwm_adapter.c +++ b/platform/pwm/pwm_adapter.c @@ -18,11 +18,14 @@ #include #include "device_resource_if.h" +#include "hdf_base.h" #include "hdf_log.h" +#include "osal_io.h" #include "osal_mem.h" #include "pwm_core.h" +#include "pwm_if.h" -#define HDF_LOG_TAG pwm_adapter +#define HDF_LOG_TAG HDF_PWM_LINUX_ADAPTER int32_t HdfPwmOpen(struct PwmDev *pwm) { @@ -57,7 +60,6 @@ int32_t HdfPwmClose(struct PwmDev *pwm) int32_t HdfPwmSetConfig(struct PwmDev *pwm, struct PwmConfig *config) { - int32_t ret; struct pwm_state state; if (pwm == NULL || pwm->priv == NULL || config == NULL) { @@ -69,15 +71,7 @@ int32_t HdfPwmSetConfig(struct PwmDev *pwm, struct PwmConfig *config) state.enabled = (config->status == PWM_ENABLE_STATUS) ? true : false; state.period = config->period; state.polarity = config->polarity; - HDF_LOGI("%s: set PwmConfig: number %u, period %u, duty %u, polarity %u, enable %u.", - __func__, config->number, config->period, config->duty, config->polarity, config->status); - ret = pwm_apply_state(pwm->priv, &state); - if (ret < 0) { - HDF_LOGE("%s: [pwm_apply_state] failed.", __func__); - return HDF_FAILURE; - } - HDF_LOGI("%s: success.", __func__); - return HDF_SUCCESS; + return pwm_apply_state(pwm->priv, &state); } struct PwmMethod g_pwmOps = { diff --git a/platform/pwm/pwm_hi35xx.h b/platform/pwm/pwm_hi35xx.h index fab0859..ecdb5a7 100644 --- a/platform/pwm/pwm_hi35xx.h +++ b/platform/pwm/pwm_hi35xx.h @@ -36,9 +36,9 @@ #define PWM_INV_OFFSET 1 #define PWM_KEEP_OFFSET 2 -#define PWM_DEFAULT_PERIOD 0x3E7 +#define PWM_DEFAULT_PERIOD 0x018F #define PWM_DEFAULT_POLARITY 0 -#define PWM_DEFAULT_DUTY_CYCLE 0x14D +#define PWM_DEFAULT_DUTY_CYCLE 0x00C7 struct HiPwmRegs { volatile uint32_t cfg0; @@ -55,7 +55,7 @@ static inline void HiPwmDisable(struct HiPwmRegs *reg) if (reg == NULL) { return; } - reg->ctrl &= ~1; + reg->ctrl = PWM_DISABLE; } static inline void HiPwmAlwaysOutput(struct HiPwmRegs *reg) diff --git a/platform/pwm/pwm_hi35xx_linux.c b/platform/pwm/pwm_hi35xx_linux.c index 68f1e7e..38c411d 100644 --- a/platform/pwm/pwm_hi35xx_linux.c +++ b/platform/pwm/pwm_hi35xx_linux.c @@ -16,15 +16,20 @@ * */ -#include "pwm_hi35xx.h" +#include #include +#include +#include +#include +#include +#include #include #include +#include #include #include -#include "hdf_log.h" +#include "pwm_hi35xx.h" -#define HDF_LOG_TAG pwm_hi35xx_linux #define PWM_ENABLE_MASK 0x1 #define PWM_HI35XX_N_CELLS 2 @@ -45,51 +50,42 @@ static int Hi35xxPwmApply(struct pwm_chip *chip, struct pwm_device *pwm, struct struct Hi35xxPwmChip *hi35xxChip = (struct Hi35xxPwmChip *)chip; if (hi35xxChip == NULL || pwm == NULL || state == NULL) { - HDF_LOGE("%s: parameter is null\n", __func__); + pr_err("%s: parameter is null\n", __func__); return -EINVAL; } reg = (struct HiPwmRegs *)hi35xxChip->base; if (state->polarity != PWM_POLARITY_NORMAL && state->polarity != PWM_POLARITY_INVERSED) { - HDF_LOGE("%s: polarity %u is invalid", __func__, state->polarity); + pr_err("%s: polarity %u is invalid", __func__, state->polarity); return -EINVAL; } if (state->period < PWM_MIN_PERIOD) { - HDF_LOGE("%s: period %llu is not support, min period %d", __func__, state->period, PWM_MIN_PERIOD); + pr_err("%s: period %u is not support, min period %u", __func__, state->period, PWM_MIN_PERIOD); return -EINVAL; } if (state->duty_cycle < 1 || state->duty_cycle > state->period) { - HDF_LOGE("%s: duty %llu is not support, duty must in [1, period = %llu].", - __func__, state->duty_cycle , state->period); + pr_err("%s: duty_cycle %u is not support, min duty_cycle 1 max duty_cycle %u", + __func__, state->duty_cycle , state->period); return -EINVAL; } HiPwmDisable(reg); - HDF_LOGI("%s: [HiPwmDisable] done.", __func__); if (pwm->state.polarity != state->polarity) { HiPwmSetPolarity(reg, state->polarity); - HDF_LOGI("%s: [HiPwmSetPolarity] done, polarity: %u -> %u.", __func__, pwm->state.polarity, state->polarity); } if (pwm->state.period != state->period) { HiPwmSetPeriod(reg, state->period); - HDF_LOGI("%s: [HiPwmSetPeriod] done, period: %llu -> %llu.", __func__, pwm->state.period, state->period); } if (pwm->state.duty_cycle != state->duty_cycle) { HiPwmSetDuty(reg, state->duty_cycle); - HDF_LOGI("%s: [HiPwmSetDuty] done, duty: %llu -> %llu.", __func__, pwm->state.duty_cycle, state->duty_cycle); } if (state->enabled) { HiPwmAlwaysOutput(reg); - HDF_LOGI("%s: [HiPwmAlwaysOutput] done, then enable.", __func__); } - - HDF_LOGI("%s: set PwmConfig done: number none, period %llu, duty %llu, polarity %u, enable %u.", - __func__, state->period, state->duty_cycle, state->polarity, state->enabled); - HDF_LOGI("%s: success.", __func__); - return 0; } + static void Hi35xxGetState(struct pwm_chip *chip, struct pwm_device *pwm, struct pwm_state *state) { struct HiPwmRegs *reg = NULL; @@ -100,13 +96,9 @@ static void Hi35xxGetState(struct pwm_chip *chip, struct pwm_device *pwm, struct return; } reg = (struct HiPwmRegs *)hi35xxChip->base; - state->period = reg->cfg0 * PWM_CLK_PERIOD; - state->duty_cycle = reg->cfg1 * PWM_CLK_PERIOD; - state->polarity = (reg->ctrl & (1 << PWM_INV_OFFSET)) >> PWM_INV_OFFSET; + state->period = reg->cfg0; + state->duty_cycle = reg->cfg1; state->enabled = reg->ctrl & PWM_ENABLE_MASK; - - HDF_LOGI("%s: get PwmConfig: number none, period %llu, duty %llu, polarity %u, enable %u.", - __func__, state->period, state->duty_cycle, state->polarity, state->enabled); } static struct pwm_ops Hi35xxPwmOps = { diff --git a/platform/rtc/rtc_adapter.c b/platform/rtc/rtc_adapter.c index 41262fd..031b529 100644 --- a/platform/rtc/rtc_adapter.c +++ b/platform/rtc/rtc_adapter.c @@ -51,7 +51,7 @@ static inline void LinuxTimeToHdfTime(struct RtcTime *hdfTime, const struct rtc_ static inline struct rtc_device *HdfGetRtcDevice(void) { - struct rtc_device *dev = rtc_class_open(CONFIG_RTC_SYSTOHC_DEVICE); + struct rtc_device *dev = rtc_class_open("rtc0"); if (dev == NULL) { HDF_LOGE("%s: failed to get rtc device", __func__); diff --git a/platform/sdio/sdio_adapter.c b/platform/sdio/sdio_adapter.c index 59fdba5..e5fc2ce 100644 --- a/platform/sdio/sdio_adapter.c +++ b/platform/sdio/sdio_adapter.c @@ -1,7 +1,7 @@ /* * sdio_adapter.c * - * hi35xx linux sdio driver implement. + * linux sdio driver implement. * * Copyright (c) 2020-2021 Huawei Device Co., Ltd. * @@ -33,32 +33,32 @@ #define MMC_SLOT_NUM 3 #define SDIO_RESCAN_WAIT_TIME 40 -struct mmc_host *himci_get_mmc_host(int slot); -void hisi_sdio_rescan(int slot); +struct mmc_host *meson_get_mmc_host(int slot); +void meson_mmc_sdio_rescan(int slot); -static struct sdio_func *Hi35xxLinuxSdioGetFunc(struct SdioDevice *dev) +static struct sdio_func *LinuxSdioGetFunc(struct SdioDevice *dev) { if (dev == NULL) { - HDF_LOGE("Hi35xxLinuxSdioGetFunc: dev is null."); + HDF_LOGE("LinuxSdioGetFunc: dev is null."); return NULL; } return (struct sdio_func *)dev->sd.mmc.priv; } -static int32_t Hi35xxLinuxSdioIncrAddrReadBytes(struct SdioDevice *dev, +static int32_t LinuxSdioIncrAddrReadBytes(struct SdioDevice *dev, uint8_t *data, uint32_t addr, uint32_t size) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); int32_t ret = HDF_SUCCESS; uint16_t *output16 = NULL; uint32_t *output32 = NULL; if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioIncrAddrReadBytes: func is NULL."); + HDF_LOGE("LinuxSdioIncrAddrReadBytes: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if ((data == NULL) || (size == 0)) { - HDF_LOGE("Hi35xxLinuxSdioIncrAddrReadBytes: data or size is invalid."); + HDF_LOGE("LinuxSdioIncrAddrReadBytes: data or size is invalid."); return HDF_ERR_INVALID_PARAM; } @@ -79,18 +79,18 @@ static int32_t Hi35xxLinuxSdioIncrAddrReadBytes(struct SdioDevice *dev, return sdio_memcpy_fromio(func, data, addr, size); } -static int32_t Hi35xxLinuxSdioIncrAddrWriteBytes(struct SdioDevice *dev, +static int32_t LinuxSdioIncrAddrWriteBytes(struct SdioDevice *dev, uint8_t *data, uint32_t addr, uint32_t size) { int32_t ret = HDF_SUCCESS; - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioIncrAddrWriteBytes: func is NULL."); + HDF_LOGE("LinuxSdioIncrAddrWriteBytes: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if ((data == NULL) || (size == 0)) { - HDF_LOGE("Hi35xxLinuxSdioIncrAddrWriteBytes: data or size is invalid."); + HDF_LOGE("LinuxSdioIncrAddrWriteBytes: data or size is invalid."); return HDF_ERR_INVALID_PARAM; } @@ -109,60 +109,60 @@ static int32_t Hi35xxLinuxSdioIncrAddrWriteBytes(struct SdioDevice *dev, return sdio_memcpy_toio(func, addr, data, size); } -static int32_t Hi35xxLinuxSdioFixedAddrReadBytes(struct SdioDevice *dev, +static int32_t LinuxSdioFixedAddrReadBytes(struct SdioDevice *dev, uint8_t *data, uint32_t addr, uint32_t size, uint32_t scatterLen) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFixedAddrReadBytes: func is NULL."); + HDF_LOGE("LinuxSdioFixedAddrReadBytes: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if ((data == NULL) || (size == 0)) { - HDF_LOGE("Hi35xxLinuxSdioFixedAddrReadBytes: data or size is invalid."); + HDF_LOGE("LinuxSdioFixedAddrReadBytes: data or size is invalid."); return HDF_ERR_INVALID_PARAM; } if (scatterLen > 0) { - HDF_LOGE("Hi35xxLinuxSdioFixedAddrReadBytes: not support!"); + HDF_LOGE("LinuxSdioFixedAddrReadBytes: not support!"); return HDF_ERR_NOT_SUPPORT; } return sdio_readsb(func, data, addr, size); } -static int32_t Hi35xxLinuxSdioFixedAddrWriteBytes(struct SdioDevice *dev, +static int32_t LinuxSdioFixedAddrWriteBytes(struct SdioDevice *dev, uint8_t *data, uint32_t addr, uint32_t size, uint32_t scatterLen) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFixedAddrWriteBytes: func is NULL."); + HDF_LOGE("LinuxSdioFixedAddrWriteBytes: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if ((data == NULL) || (size == 0)) { - HDF_LOGE("Hi35xxLinuxSdioFixedAddrReadBytes: data or size is invalid."); + HDF_LOGE("LinuxSdioFixedAddrReadBytes: data or size is invalid."); return HDF_ERR_INVALID_PARAM; } if (scatterLen > 0) { - HDF_LOGE("Hi35xxLinuxSdioFixedAddrWriteBytes: not support!"); + HDF_LOGE("LinuxSdioFixedAddrWriteBytes: not support!"); return HDF_ERR_NOT_SUPPORT; } return sdio_writesb(func, addr, data, size); } -static int32_t Hi35xxLinuxSdioFunc0ReadBytes(struct SdioDevice *dev, +static int32_t LinuxSdioFunc0ReadBytes(struct SdioDevice *dev, uint8_t *data, uint32_t addr, uint32_t size) { int32_t ret = HDF_SUCCESS; - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFunc0ReadBytes: func is NULL."); + HDF_LOGE("LinuxSdioFunc0ReadBytes: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if ((data == NULL) || (size == 0)) { - HDF_LOGE("Hi35xxLinuxSdioFunc0ReadBytes: data or size is invalid."); + HDF_LOGE("LinuxSdioFunc0ReadBytes: data or size is invalid."); return HDF_ERR_INVALID_PARAM; } @@ -170,18 +170,18 @@ static int32_t Hi35xxLinuxSdioFunc0ReadBytes(struct SdioDevice *dev, return ret; } -static int32_t Hi35xxLinuxSdioFunc0WriteBytes(struct SdioDevice *dev, +static int32_t LinuxSdioFunc0WriteBytes(struct SdioDevice *dev, uint8_t *data, uint32_t addr, uint32_t size) { int32_t ret = HDF_SUCCESS; - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFunc0WriteBytes: func is NULL."); + HDF_LOGE("LinuxSdioFunc0WriteBytes: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if ((data == NULL) || (size == 0)) { - HDF_LOGE("Hi35xxLinuxSdioFunc0WriteBytes: data or size is invalid."); + HDF_LOGE("LinuxSdioFunc0WriteBytes: data or size is invalid."); return HDF_ERR_INVALID_PARAM; } @@ -189,41 +189,41 @@ static int32_t Hi35xxLinuxSdioFunc0WriteBytes(struct SdioDevice *dev, return ret; } -static int32_t Hi35xxLinuxSdioSetBlockSize(struct SdioDevice *dev, uint32_t blockSize) +static int32_t LinuxSdioSetBlockSize(struct SdioDevice *dev, uint32_t blockSize) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioSetBlockSize, func is NULL."); + HDF_LOGE("LinuxSdioSetBlockSize, func is NULL."); return HDF_ERR_INVALID_OBJECT; } return sdio_set_block_size(func, blockSize); } -static int32_t Hi35xxLinuxSdioGetCommonInfo(struct SdioDevice *dev, +static int32_t LinuxSdioGetCommonInfo(struct SdioDevice *dev, SdioCommonInfo *info, uint32_t infoType) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioGetCommonInfo: func is NULL."); + HDF_LOGE("LinuxSdioGetCommonInfo: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if (info == NULL) { - HDF_LOGE("Hi35xxLinuxSdioGetCommonInfo: info is null."); + HDF_LOGE("LinuxSdioGetCommonInfo: info is null."); return HDF_ERR_INVALID_PARAM; } if (infoType != SDIO_FUNC_INFO) { - HDF_LOGE("Hi35xxLinuxSdioGetCommonInfo: cur type %d is not support.", infoType); + HDF_LOGE("LinuxSdioGetCommonInfo: cur type %d is not support.", infoType); return HDF_ERR_NOT_SUPPORT; } if (func->card == NULL) { - HDF_LOGE("Hi35xxLinuxSdioGetCommonInfo fail, card is null."); + HDF_LOGE("LinuxSdioGetCommonInfo fail, card is null."); return HDF_ERR_INVALID_PARAM; } if (func->card->host == NULL) { - HDF_LOGE("Hi35xxLinuxSdioGetCommonInfo fail, host is null."); + HDF_LOGE("LinuxSdioGetCommonInfo fail, host is null."); return HDF_ERR_INVALID_PARAM; } info->funcInfo.enTimeout = func->enable_timeout; @@ -236,30 +236,30 @@ static int32_t Hi35xxLinuxSdioGetCommonInfo(struct SdioDevice *dev, return HDF_SUCCESS; } -static int32_t Hi35xxLinuxSdioSetCommonInfo(struct SdioDevice *dev, +static int32_t LinuxSdioSetCommonInfo(struct SdioDevice *dev, SdioCommonInfo *info, uint32_t infoType) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioSetCommonInfo: func is NULL."); + HDF_LOGE("LinuxSdioSetCommonInfo: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if (info == NULL) { - HDF_LOGE("Hi35xxLinuxSdioSetCommonInfo: info is null."); + HDF_LOGE("LinuxSdioSetCommonInfo: info is null."); return HDF_ERR_INVALID_PARAM; } if (infoType != SDIO_FUNC_INFO) { - HDF_LOGE("Hi35xxLinuxSdioSetCommonInfo: cur type %d is not support.", infoType); + HDF_LOGE("LinuxSdioSetCommonInfo: cur type %d is not support.", infoType); return HDF_ERR_NOT_SUPPORT; } if (func->card == NULL) { - HDF_LOGE("Hi35xxLinuxSdioSetCommonInfo fail, card is null."); + HDF_LOGE("LinuxSdioSetCommonInfo fail, card is null."); return HDF_ERR_INVALID_PARAM; } if (func->card->host == NULL) { - HDF_LOGE("Hi35xxLinuxSdioSetCommonInfo fail, host is null."); + HDF_LOGE("LinuxSdioSetCommonInfo fail, host is null."); return HDF_ERR_INVALID_PARAM; } func->enable_timeout = info->funcInfo.enTimeout; @@ -270,95 +270,95 @@ static int32_t Hi35xxLinuxSdioSetCommonInfo(struct SdioDevice *dev, return HDF_SUCCESS; } -static int32_t Hi35xxLinuxSdioFlushData(struct SdioDevice *dev) +static int32_t LinuxSdioFlushData(struct SdioDevice *dev) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFlushData: func is NULL."); + HDF_LOGE("LinuxSdioFlushData: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if (func->card == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFlushData: card is NULL."); + HDF_LOGE("LinuxSdioFlushData: card is NULL."); return HDF_ERR_INVALID_OBJECT; } - return mmc_sw_reset(func->card->host); + return mmc_hw_reset(func->card->host); } -static int32_t Hi35xxLinuxSdioClaimHost(struct SdioDevice *dev) +static int32_t LinuxSdioClaimHost(struct SdioDevice *dev) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioClaimHost: func is NULL."); + HDF_LOGE("LinuxSdioClaimHost: func is NULL."); return HDF_ERR_INVALID_OBJECT; } sdio_claim_host(func); return HDF_SUCCESS; } -static int32_t Hi35xxLinuxSdioReleaseHost(struct SdioDevice *dev) +static int32_t LinuxSdioReleaseHost(struct SdioDevice *dev) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioReleaseHost: func is NULL."); + HDF_LOGE("LinuxSdioReleaseHost: func is NULL."); return HDF_ERR_INVALID_OBJECT; } sdio_release_host(func); return HDF_SUCCESS; } -static int32_t Hi35xxLinuxSdioEnableFunc(struct SdioDevice *dev) +static int32_t LinuxSdioEnableFunc(struct SdioDevice *dev) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioEnableFunc: func is NULL."); + HDF_LOGE("LinuxSdioEnableFunc: func is NULL."); return HDF_ERR_INVALID_OBJECT; } return sdio_enable_func(func); } -static int32_t Hi35xxLinuxSdioDisableFunc(struct SdioDevice *dev) +static int32_t LinuxSdioDisableFunc(struct SdioDevice *dev) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioDisableFunc: func is NULL."); + HDF_LOGE("LinuxSdioDisableFunc: func is NULL."); return HDF_ERR_INVALID_OBJECT; } return sdio_disable_func(func); } -static int32_t Hi35xxLinuxSdioClaimIrq(struct SdioDevice *dev, SdioIrqHandler *handler) +static int32_t LinuxSdioClaimIrq(struct SdioDevice *dev, SdioIrqHandler *handler) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioClaimIrq: func is NULL."); + HDF_LOGE("LinuxSdioClaimIrq: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if (handler == NULL) { - HDF_LOGE("Hi35xxLinuxSdioClaimIrq: handler is null."); + HDF_LOGE("LinuxSdioClaimIrq: handler is null."); return HDF_ERR_INVALID_PARAM; } return sdio_claim_irq(func, (sdio_irq_handler_t *)handler); } -static int32_t Hi35xxLinuxSdioReleaseIrq(struct SdioDevice *dev) +static int32_t LinuxSdioReleaseIrq(struct SdioDevice *dev) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioReleaseIrq: func is NULL."); + HDF_LOGE("LinuxSdioReleaseIrq: func is NULL."); return HDF_ERR_INVALID_OBJECT; } return sdio_release_irq(func); } -static struct sdio_func *Hi35xxLinuxSdioSearchFunc(uint32_t funcNum, uint16_t vendorId, uint16_t deviceId) +static struct sdio_func *LinuxSdioSearchFunc(uint32_t funcNum, uint16_t vendorId, uint16_t deviceId) { struct mmc_card *card = NULL; struct mmc_host *host = NULL; @@ -366,7 +366,7 @@ static struct sdio_func *Hi35xxLinuxSdioSearchFunc(uint32_t funcNum, uint16_t ve uint32_t i, j; for (i = 0; i < MMC_SLOT_NUM; i++) { - host = himci_get_mmc_host(i); + host = meson_get_mmc_host(i); if (host == NULL) { continue; } @@ -380,57 +380,57 @@ static struct sdio_func *Hi35xxLinuxSdioSearchFunc(uint32_t funcNum, uint16_t ve (func->num == funcNum) && (func->vendor == vendorId) && (func->device == deviceId)) { - HDF_LOGD("Hi35xxLinuxSdioSearchFunc: find func!"); + HDF_LOGD("LinuxSdioSearchFunc: find func!"); return func; } } } - HDF_LOGE("Hi35xxLinuxSdioSearchFunc: get sdio func fail!"); + HDF_LOGE("LinuxSdioSearchFunc: get sdio func fail!"); return NULL; } -static int32_t Hi35xxLinuxSdioFindFunc(struct SdioDevice *dev, struct SdioFunctionConfig *configData) +static int32_t LinuxSdioFindFunc(struct SdioDevice *dev, struct SdioFunctionConfig *configData) { if (dev == NULL || configData == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFindFunc: dev or configData is NULL."); + HDF_LOGE("LinuxSdioFindFunc: dev or configData is NULL."); return HDF_ERR_INVALID_OBJECT; } - dev->sd.mmc.priv = Hi35xxLinuxSdioSearchFunc(configData->funcNr, configData->vendorId, configData->deviceId); + dev->sd.mmc.priv = LinuxSdioSearchFunc(configData->funcNr, configData->vendorId, configData->deviceId); if (dev->sd.mmc.priv == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFindFunc: Hi35xxLinuxSdioSearchFunc fail."); + HDF_LOGE("LinuxSdioFindFunc: LinuxSdioSearchFunc fail."); return HDF_ERR_NOT_SUPPORT; } return HDF_SUCCESS; } static struct SdioDeviceOps g_sdioDeviceOps = { - .incrAddrReadBytes = Hi35xxLinuxSdioIncrAddrReadBytes, - .incrAddrWriteBytes = Hi35xxLinuxSdioIncrAddrWriteBytes, - .fixedAddrReadBytes = Hi35xxLinuxSdioFixedAddrReadBytes, - .fixedAddrWriteBytes = Hi35xxLinuxSdioFixedAddrWriteBytes, - .func0ReadBytes = Hi35xxLinuxSdioFunc0ReadBytes, - .func0WriteBytes = Hi35xxLinuxSdioFunc0WriteBytes, - .setBlockSize = Hi35xxLinuxSdioSetBlockSize, - .getCommonInfo = Hi35xxLinuxSdioGetCommonInfo, - .setCommonInfo = Hi35xxLinuxSdioSetCommonInfo, - .flushData = Hi35xxLinuxSdioFlushData, - .enableFunc = Hi35xxLinuxSdioEnableFunc, - .disableFunc = Hi35xxLinuxSdioDisableFunc, - .claimIrq = Hi35xxLinuxSdioClaimIrq, - .releaseIrq = Hi35xxLinuxSdioReleaseIrq, - .findFunc = Hi35xxLinuxSdioFindFunc, - .claimHost = Hi35xxLinuxSdioClaimHost, - .releaseHost = Hi35xxLinuxSdioReleaseHost, + .incrAddrReadBytes = LinuxSdioIncrAddrReadBytes, + .incrAddrWriteBytes = LinuxSdioIncrAddrWriteBytes, + .fixedAddrReadBytes = LinuxSdioFixedAddrReadBytes, + .fixedAddrWriteBytes = LinuxSdioFixedAddrWriteBytes, + .func0ReadBytes = LinuxSdioFunc0ReadBytes, + .func0WriteBytes = LinuxSdioFunc0WriteBytes, + .setBlockSize = LinuxSdioSetBlockSize, + .getCommonInfo = LinuxSdioGetCommonInfo, + .setCommonInfo = LinuxSdioSetCommonInfo, + .flushData = LinuxSdioFlushData, + .enableFunc = LinuxSdioEnableFunc, + .disableFunc = LinuxSdioDisableFunc, + .claimIrq = LinuxSdioClaimIrq, + .releaseIrq = LinuxSdioReleaseIrq, + .findFunc = LinuxSdioFindFunc, + .claimHost = LinuxSdioClaimHost, + .releaseHost = LinuxSdioReleaseHost, }; -static bool Hi35xxLinuxSdioRescanFinish(struct MmcCntlr *cntlr) +static bool LinuxSdioRescanFinish(struct MmcCntlr *cntlr) { struct mmc_host *host = NULL; struct mmc_card *card = NULL; - host = himci_get_mmc_host(cntlr->index); + host = meson_get_mmc_host(cntlr->index); if (host == NULL) { return false; } @@ -445,25 +445,25 @@ static bool Hi35xxLinuxSdioRescanFinish(struct MmcCntlr *cntlr) return false; } -static int32_t Hi35xxLinuxSdioRescan(struct MmcCntlr *cntlr) +static int32_t LinuxSdioRescan(struct MmcCntlr *cntlr) { bool rescanFinish = false; uint32_t count = 0; if (cntlr == NULL) { - HDF_LOGE("Hi35xxLinuxSdioRescan: cntlr is NULL."); + HDF_LOGE("LinuxSdioRescan: cntlr is NULL."); return HDF_ERR_INVALID_OBJECT; } - hisi_sdio_rescan(cntlr->index); + meson_mmc_sdio_rescan(cntlr->index); while (rescanFinish == false && count < SDIO_RESCAN_WAIT_TIME) { OsalMSleep(50); count++; - rescanFinish = Hi35xxLinuxSdioRescanFinish(cntlr); + rescanFinish = LinuxSdioRescanFinish(cntlr); } if (rescanFinish == false) { - HDF_LOGE("Hi35xxLinuxSdioRescan: fail!"); + HDF_LOGE("LinuxSdioRescan: fail!"); return HDF_FAILURE; } @@ -471,11 +471,11 @@ static int32_t Hi35xxLinuxSdioRescan(struct MmcCntlr *cntlr) return HDF_SUCCESS; } -struct MmcCntlrOps g_sdioCntlrOps = { - .rescanSdioDev = Hi35xxLinuxSdioRescan, +struct MmcCntlrOps g_sdiodntlrops = { + .rescanSdioDev = LinuxSdioRescan, }; -static void Hi35xxLinuxSdioDeleteCntlr(struct MmcCntlr *cntlr) +static void LinuxSdioDeleteCntlr(struct MmcCntlr *cntlr) { if (cntlr == NULL) { return; @@ -489,110 +489,111 @@ static void Hi35xxLinuxSdioDeleteCntlr(struct MmcCntlr *cntlr) OsalMemFree(cntlr); } -static int32_t Hi35xxLinuxSdioCntlrParse(struct MmcCntlr *cntlr, struct HdfDeviceObject *obj) +static int32_t LinuxSdioCntlrParse(struct MmcCntlr *cntlr, struct HdfDeviceObject *obj) { const struct DeviceResourceNode *node = NULL; struct DeviceResourceIface *drsOps = NULL; int32_t ret; if (obj == NULL || cntlr == NULL) { - HDF_LOGE("Hi35xxLinuxSdioCntlrParse: input para is NULL."); + HDF_LOGE("LinuxSdioCntlrParse: input para is NULL."); return HDF_FAILURE; } node = obj->property; if (node == NULL) { - HDF_LOGE("Hi35xxLinuxSdioCntlrParse: drs node is NULL."); + HDF_LOGE("LinuxSdioCntlrParse: drs node is NULL."); return HDF_FAILURE; } drsOps = DeviceResourceGetIfaceInstance(HDF_CONFIG_SOURCE); if (drsOps == NULL || drsOps->GetUint16 == NULL || drsOps->GetUint32 == NULL) { - HDF_LOGE("Hi35xxLinuxSdioCntlrParse: invalid drs ops fail!"); + HDF_LOGE("LinuxSdioCntlrParse: invalid drs ops fail!"); return HDF_FAILURE; } ret = drsOps->GetUint16(node, "hostId", &(cntlr->index), 0); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxSdioCntlrParse: read hostIndex fail!"); + HDF_LOGE("LinuxSdioCntlrParse: read hostIndex fail!"); return ret; } ret = drsOps->GetUint32(node, "devType", &(cntlr->devType), 0); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxSdioCntlrParse: read devType fail!"); + HDF_LOGE("LinuxSdioCntlrParse: read devType fail!"); return ret; } - HDF_LOGD("Hi35xxLinuxSdioCntlrParse: hostIndex = %d, devType = %d.", cntlr->index, cntlr->devType); + HDF_LOGD("LinuxSdioCntlrParse: hostIndex = %d, devType = %d.", cntlr->index, cntlr->devType); return HDF_SUCCESS; } -static int32_t Hi35xxLinuxSdioBind(struct HdfDeviceObject *obj) +static int32_t LinuxSdioBind(struct HdfDeviceObject *obj) { struct MmcCntlr *cntlr = NULL; int32_t ret; - HDF_LOGE("Hi35xxLinuxSdioBind: entry!"); + HDF_LOGE("LinuxSdioBind: entry!"); if (obj == NULL) { - HDF_LOGE("Hi35xxLinuxSdioBind: Fail, obj is NULL."); + HDF_LOGE("LinuxSdioBind: Fail, obj is NULL."); return HDF_ERR_INVALID_OBJECT; } cntlr = (struct MmcCntlr *)OsalMemCalloc(sizeof(struct MmcCntlr)); if (cntlr == NULL) { - HDF_LOGE("Hi35xxLinuxSdioBind: no mem for MmcCntlr."); + HDF_LOGE("LinuxSdioBind: no mem for MmcCntlr."); return HDF_ERR_MALLOC_FAIL; } - cntlr->ops = &g_sdioCntlrOps; + cntlr->ops = &g_sdiodntlrops; cntlr->hdfDevObj = obj; obj->service = &cntlr->service; /* init cntlr. */ - ret = Hi35xxLinuxSdioCntlrParse(cntlr, obj); + ret = LinuxSdioCntlrParse(cntlr, obj); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxSdioBind: cntlr parse fail."); - goto _ERR; + HDF_LOGE("LinuxSdioBind: cntlr parse fail."); + LinuxSdioDeleteCntlr(cntlr); + HDF_LOGE("LinuxSdioBind: Fail!"); + return HDF_FAILURE; } ret = MmcCntlrAdd(cntlr); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxSdioBind: cntlr add fail."); - goto _ERR; + HDF_LOGE("LinuxSdioBind: cntlr add fail."); + LinuxSdioDeleteCntlr(cntlr); + HDF_LOGE("LinuxSdioBind: Fail!"); + return HDF_FAILURE; } ret = MmcCntlrAllocDev(cntlr, (enum MmcDevType)cntlr->devType); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxSdioBind: alloc dev fail."); - goto _ERR; + HDF_LOGE("LinuxSdioBind: alloc dev fail."); + LinuxSdioDeleteCntlr(cntlr); + HDF_LOGE("LinuxSdioBind: Fail!"); + return HDF_FAILURE; } MmcDeviceAddOps(cntlr->curDev, &g_sdioDeviceOps); - HDF_LOGD("Hi35xxLinuxSdioBind: Success!"); + HDF_LOGD("LinuxSdioBind: Success!"); return HDF_SUCCESS; - -_ERR: - Hi35xxLinuxSdioDeleteCntlr(cntlr); - HDF_LOGE("Hi35xxLinuxSdioBind: Fail!"); - return HDF_FAILURE; } -static int32_t Hi35xxLinuxSdioInit(struct HdfDeviceObject *obj) +static int32_t LinuxSdioInit(struct HdfDeviceObject *obj) { (void)obj; - HDF_LOGD("Hi35xxLinuxSdioInit: Success!"); + HDF_LOGD("LinuxSdioInit: Success!"); return HDF_SUCCESS; } -static void Hi35xxLinuxSdioRelease(struct HdfDeviceObject *obj) +static void LinuxSdioRelease(struct HdfDeviceObject *obj) { if (obj == NULL) { return; } - Hi35xxLinuxSdioDeleteCntlr((struct MmcCntlr *)obj->service); + LinuxSdioDeleteCntlr((struct MmcCntlr *)obj->service); } -struct HdfDriverEntry g_sdioDriverEntry = { +struct HdfDriverEntry g_sdiodriverentry = { .moduleVersion = 1, - .Bind = Hi35xxLinuxSdioBind, - .Init = Hi35xxLinuxSdioInit, - .Release = Hi35xxLinuxSdioRelease, + .Bind = LinuxSdioBind, + .Init = LinuxSdioInit, + .Release = LinuxSdioRelease, .moduleName = "HDF_PLATFORM_SDIO", }; -HDF_INIT(g_sdioDriverEntry); +HDF_INIT(g_sdiodriverentry); diff --git a/platform/spi/Makefile b/platform/spi/Makefile index d049969..3574fa4 100644 --- a/platform/spi/Makefile +++ b/platform/spi/Makefile @@ -16,5 +16,5 @@ include drivers/hdf/khdf/platform/platform.mk obj-y += $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/spi_core.o \ $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/spi_if.o \ - hi35xx_spi_adapter.o + spi_adapter.o diff --git a/platform/spi/hi35xx_spi_adapter.c b/platform/spi/spi_adapter.c similarity index 98% rename from platform/spi/hi35xx_spi_adapter.c rename to platform/spi/spi_adapter.c index 5cbc8f6..4f60cb5 100644 --- a/platform/spi/hi35xx_spi_adapter.c +++ b/platform/spi/spi_adapter.c @@ -151,12 +151,15 @@ static int32_t SpiAdatperTransfer(struct SpiCntlr *cntlr, struct SpiMsg *msg, ui transfer[i].tx_buf = msg[i].wbuf; transfer[i].rx_buf = msg[i].rbuf; transfer[i].len = msg[i].len; - if (msg[i].speed != 0) + if (msg[i].speed != 0){ transfer[i].speed_hz = msg[i].speed; - if (msg[i].csChange != 0) + } + if (msg[i].csChange != 0){ transfer[i].cs_change = msg[i].csChange; - if (msg[i].delayUs != 0) + } + if (msg[i].delayUs != 0){ transfer[i].delay_usecs = msg[i].delayUs; + } spi_message_add_tail(&transfer[i], &xfer); } @@ -307,7 +310,7 @@ static int32_t SpiGetBaseCfgFromHcs(struct SpiCntlr *cntlr, const struct DeviceR static int SpiCntlrInit(struct SpiCntlr *cntlr, const struct HdfDeviceObject *device) { - int ret; + int ret = HDF_SUCCESS; if (device->property == NULL) { HDF_LOGE("%s: property is NULL", __func__); @@ -321,7 +324,7 @@ static int SpiCntlrInit(struct SpiCntlr *cntlr, const struct HdfDeviceObject *de } cntlr->method = &g_method; - return 0; + return HDF_SUCCESS; } static int32_t HdfSpiDeviceBind(struct HdfDeviceObject *device) @@ -335,7 +338,7 @@ static int32_t HdfSpiDeviceBind(struct HdfDeviceObject *device) static int32_t HdfSpiDeviceInit(struct HdfDeviceObject *device) { - int ret; + int ret = HDF_SUCCESS; struct SpiCntlr *cntlr = NULL; HDF_LOGI("%s: entry", __func__); diff --git a/platform/uart/uart_adapter.c b/platform/uart/uart_adapter.c index e817626..c9bcf7b 100644 --- a/platform/uart/uart_adapter.c +++ b/platform/uart/uart_adapter.c @@ -484,7 +484,7 @@ static int32_t HdfUartInit(struct HdfDeviceObject *obj) HDF_LOGE("%s: read num fail", __func__); return HDF_FAILURE; } - if (iface->GetString(obj->property, "driver_name", &drName, "ttyAMA") != HDF_SUCCESS) { + if (iface->GetString(obj->property, "driver_name", &drName, "ttyS") != HDF_SUCCESS) { HDF_LOGE("%s: read driver_name fail", __func__); return HDF_FAILURE; } diff --git a/platform/watchdog/watchdog_adapter.c b/platform/watchdog/watchdog_adapter.c index 309a4d1..5014e9b 100644 --- a/platform/watchdog/watchdog_adapter.c +++ b/platform/watchdog/watchdog_adapter.c @@ -148,7 +148,7 @@ static struct watchdog_device *WdtCoreDataToWdd(void *wdCoreData) * } */ struct WdtCoreDataHead { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,182) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) struct device dev; #else struct kref kref; -- Gitee From 9231f83ac4551bf581b74b55585761d703424592 Mon Sep 17 00:00:00 2001 From: zhaoxc0502 Date: Tue, 28 Dec 2021 13:17:09 +0800 Subject: [PATCH 2/2] merge s905D3 content Signed-off-by: zhaoxc0502 --- platform/sdio/sdio_adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/sdio/sdio_adapter.c b/platform/sdio/sdio_adapter.c index e5fc2ce..3af6b88 100644 --- a/platform/sdio/sdio_adapter.c +++ b/platform/sdio/sdio_adapter.c @@ -472,7 +472,7 @@ static int32_t LinuxSdioRescan(struct MmcCntlr *cntlr) } struct MmcCntlrOps g_sdiodntlrops = { - .rescanSdioDev = LinuxSdioRescan, + // .rescanSdioDev = LinuxSdioRescan, }; static void LinuxSdioDeleteCntlr(struct MmcCntlr *cntlr) -- Gitee