mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
dpll: zl3073x: Add low-level flash functions
To implement the devlink device flash functionality, the driver needs to access both the device memory and the internal flash memory. The flash memory is accessed using a device-specific program (called the flash utility). This flash utility must be downloaded by the driver into the device memory and then executed by the device CPU. Once running, the flash utility provides a flash API to access the flash memory itself. During this operation, the normal functionality provided by the standard firmware is not available. Therefore, the driver must ensure that DPLL callbacks and monitoring functions are not executed during the flash operation. Add all necessary functions for downloading the utility to device memory, entering and exiting flash mode, and performing flash operations. Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: Ivan Vecera <ivecera@redhat.com> Link: https://patch.msgid.link/20250909091532.11790-3-ivecera@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
259ede9da4
commit
3639bd0876
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
obj-$(CONFIG_ZL3073X) += zl3073x.o
|
||||
zl3073x-objs := core.o devlink.o dpll.o prop.o
|
||||
zl3073x-objs := core.o devlink.o dpll.o flash.o prop.o
|
||||
|
||||
obj-$(CONFIG_ZL3073X_I2C) += zl3073x_i2c.o
|
||||
zl3073x_i2c-objs := i2c.o
|
||||
|
||||
@@ -138,6 +138,15 @@ zl3073x_devlink_reload_up(struct devlink *devlink,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void zl3073x_devlink_flash_notify(struct zl3073x_dev *zldev, const char *msg,
|
||||
const char *component, u32 done, u32 total)
|
||||
{
|
||||
struct devlink *devlink = priv_to_devlink(zldev);
|
||||
|
||||
devlink_flash_update_status_notify(devlink, msg, component, done,
|
||||
total);
|
||||
}
|
||||
|
||||
static const struct devlink_ops zl3073x_devlink_ops = {
|
||||
.info_get = zl3073x_devlink_info_get,
|
||||
.reload_actions = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT),
|
||||
|
||||
@@ -9,4 +9,7 @@ struct zl3073x_dev *zl3073x_devm_alloc(struct device *dev);
|
||||
|
||||
int zl3073x_devlink_register(struct zl3073x_dev *zldev);
|
||||
|
||||
void zl3073x_devlink_flash_notify(struct zl3073x_dev *zldev, const char *msg,
|
||||
const char *component, u32 done, u32 total);
|
||||
|
||||
#endif /* _ZL3073X_DEVLINK_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
|
||||
#ifndef __ZL3073X_FLASH_H
|
||||
#define __ZL3073X_FLASH_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct netlink_ext_ack;
|
||||
struct zl3073x_dev;
|
||||
|
||||
int zl3073x_flash_mode_enter(struct zl3073x_dev *zldev, const void *util_ptr,
|
||||
size_t util_size, struct netlink_ext_ack *extack);
|
||||
|
||||
int zl3073x_flash_mode_leave(struct zl3073x_dev *zldev,
|
||||
struct netlink_ext_ack *extack);
|
||||
|
||||
int zl3073x_flash_page(struct zl3073x_dev *zldev, const char *component,
|
||||
u32 page, u32 addr, const void *data, size_t size,
|
||||
struct netlink_ext_ack *extack);
|
||||
|
||||
int zl3073x_flash_page_copy(struct zl3073x_dev *zldev, const char *component,
|
||||
u32 src_page, u32 dst_page,
|
||||
struct netlink_ext_ack *extack);
|
||||
|
||||
int zl3073x_flash_sectors(struct zl3073x_dev *zldev, const char *component,
|
||||
u32 page, u32 addr, const void *data, size_t size,
|
||||
struct netlink_ext_ack *extack);
|
||||
|
||||
#endif /* __ZL3073X_FLASH_H */
|
||||
@@ -72,6 +72,9 @@
|
||||
#define ZL_REG_FW_VER ZL_REG(0, 0x05, 2)
|
||||
#define ZL_REG_CUSTOM_CONFIG_VER ZL_REG(0, 0x07, 4)
|
||||
|
||||
#define ZL_REG_RESET_STATUS ZL_REG(0, 0x18, 1)
|
||||
#define ZL_REG_RESET_STATUS_RESET BIT(0)
|
||||
|
||||
/*************************
|
||||
* Register Page 2, Status
|
||||
*************************/
|
||||
@@ -272,4 +275,40 @@
|
||||
#define ZL_REG_HWREG_WRITE_DATA ZL_REG(0xff, 0x08, 4)
|
||||
#define ZL_REG_HWREG_READ_DATA ZL_REG(0xff, 0x0c, 4)
|
||||
|
||||
/*
|
||||
* Registers available in flash mode
|
||||
*/
|
||||
#define ZL_REG_FLASH_HASH ZL_REG(0, 0x78, 4)
|
||||
#define ZL_REG_FLASH_FAMILY ZL_REG(0, 0x7c, 1)
|
||||
#define ZL_REG_FLASH_RELEASE ZL_REG(0, 0x7d, 1)
|
||||
|
||||
#define ZL_REG_HOST_CONTROL ZL_REG(1, 0x02, 1)
|
||||
#define ZL_HOST_CONTROL_ENABLE BIT(0)
|
||||
|
||||
#define ZL_REG_IMAGE_START_ADDR ZL_REG(1, 0x04, 4)
|
||||
#define ZL_REG_IMAGE_SIZE ZL_REG(1, 0x08, 4)
|
||||
#define ZL_REG_FLASH_INDEX_READ ZL_REG(1, 0x0c, 4)
|
||||
#define ZL_REG_FLASH_INDEX_WRITE ZL_REG(1, 0x10, 4)
|
||||
#define ZL_REG_FILL_PATTERN ZL_REG(1, 0x14, 4)
|
||||
|
||||
#define ZL_REG_WRITE_FLASH ZL_REG(1, 0x18, 1)
|
||||
#define ZL_WRITE_FLASH_OP GENMASK(2, 0)
|
||||
#define ZL_WRITE_FLASH_OP_DONE 0x0
|
||||
#define ZL_WRITE_FLASH_OP_SECTORS 0x2
|
||||
#define ZL_WRITE_FLASH_OP_PAGE 0x3
|
||||
#define ZL_WRITE_FLASH_OP_COPY_PAGE 0x4
|
||||
|
||||
#define ZL_REG_FLASH_INFO ZL_REG(2, 0x00, 1)
|
||||
#define ZL_FLASH_INFO_SECTOR_SIZE GENMASK(3, 0)
|
||||
#define ZL_FLASH_INFO_SECTOR_4K 0
|
||||
#define ZL_FLASH_INFO_SECTOR_64K 1
|
||||
|
||||
#define ZL_REG_ERROR_COUNT ZL_REG(2, 0x04, 4)
|
||||
#define ZL_REG_ERROR_CAUSE ZL_REG(2, 0x08, 4)
|
||||
|
||||
#define ZL_REG_OP_STATE ZL_REG(2, 0x14, 1)
|
||||
#define ZL_OP_STATE_NO_COMMAND 0
|
||||
#define ZL_OP_STATE_PENDING 1
|
||||
#define ZL_OP_STATE_DONE 2
|
||||
|
||||
#endif /* _ZL3073X_REGS_H */
|
||||
|
||||
Reference in New Issue
Block a user