mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 10:08:59 +00:00
62b7f5931c
bcm2708: boot tested on RPi B+ v1.2
bcm2709: boot tested on RPi 3B v1.2 and RPi 4B v1.1 4G
bcm2710: boot tested on RPi 3B v1.2
bcm2711: boot tested on RPi 4B v1.1 4G
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry-picked from commit f07e572f64
)
81 lines
2.5 KiB
Diff
81 lines
2.5 KiB
Diff
From d9b492679a107e535cfd39ee00bd2ce6f12089e0 Mon Sep 17 00:00:00 2001
|
|
From: Maxime Ripard <maxime@cerno.tech>
|
|
Date: Tue, 26 May 2020 14:23:04 +0200
|
|
Subject: [PATCH] clk: bcm: rpi: Add an enum for the firmware clocks
|
|
|
|
While the firmware allows us to discover the available clocks, we need to
|
|
discriminate those clocks to only register the ones meaningful to Linux.
|
|
The firmware also doesn't provide a clock name, so having a list of the ID
|
|
will help us to give clocks a proper name later on.
|
|
|
|
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
|
|
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
|
---
|
|
drivers/clk/bcm/clk-raspberrypi.c | 30 ++++++++++++++++++++++++------
|
|
1 file changed, 24 insertions(+), 6 deletions(-)
|
|
|
|
--- a/drivers/clk/bcm/clk-raspberrypi.c
|
|
+++ b/drivers/clk/bcm/clk-raspberrypi.c
|
|
@@ -18,7 +18,23 @@
|
|
|
|
#include <soc/bcm2835/raspberrypi-firmware.h>
|
|
|
|
-#define RPI_FIRMWARE_ARM_CLK_ID 0x00000003
|
|
+enum rpi_firmware_clk_id {
|
|
+ RPI_FIRMWARE_EMMC_CLK_ID = 1,
|
|
+ RPI_FIRMWARE_UART_CLK_ID,
|
|
+ RPI_FIRMWARE_ARM_CLK_ID,
|
|
+ RPI_FIRMWARE_CORE_CLK_ID,
|
|
+ RPI_FIRMWARE_V3D_CLK_ID,
|
|
+ RPI_FIRMWARE_H264_CLK_ID,
|
|
+ RPI_FIRMWARE_ISP_CLK_ID,
|
|
+ RPI_FIRMWARE_SDRAM_CLK_ID,
|
|
+ RPI_FIRMWARE_PIXEL_CLK_ID,
|
|
+ RPI_FIRMWARE_PWM_CLK_ID,
|
|
+ RPI_FIRMWARE_HEVC_CLK_ID,
|
|
+ RPI_FIRMWARE_EMMC2_CLK_ID,
|
|
+ RPI_FIRMWARE_M2MC_CLK_ID,
|
|
+ RPI_FIRMWARE_PIXEL_BVB_CLK_ID,
|
|
+ RPI_FIRMWARE_NUM_CLK_ID,
|
|
+};
|
|
|
|
#define RPI_FIRMWARE_STATE_ENABLE_BIT BIT(0)
|
|
#define RPI_FIRMWARE_STATE_WAIT_BIT BIT(1)
|
|
@@ -31,8 +47,6 @@
|
|
|
|
#define A2W_PLL_FRAC_BITS 20
|
|
|
|
-#define NUM_FW_CLKS 16
|
|
-
|
|
struct raspberrypi_clk {
|
|
struct device *dev;
|
|
struct rpi_firmware *firmware;
|
|
@@ -350,12 +364,15 @@ static int raspberrypi_discover_clocks(s
|
|
struct rpi_firmware_get_clocks_response *clks;
|
|
int ret;
|
|
|
|
- clks = devm_kcalloc(rpi->dev, sizeof(*clks), NUM_FW_CLKS, GFP_KERNEL);
|
|
+ clks = devm_kcalloc(rpi->dev,
|
|
+ sizeof(*clks), RPI_FIRMWARE_NUM_CLK_ID,
|
|
+ GFP_KERNEL);
|
|
if (!clks)
|
|
return -ENOMEM;
|
|
|
|
ret = rpi_firmware_property(rpi->firmware, RPI_FIRMWARE_GET_CLOCKS,
|
|
- clks, sizeof(*clks) * NUM_FW_CLKS);
|
|
+ clks,
|
|
+ sizeof(*clks) * RPI_FIRMWARE_NUM_CLK_ID);
|
|
if (ret)
|
|
return ret;
|
|
|
|
@@ -411,7 +428,8 @@ static int raspberrypi_clk_probe(struct
|
|
rpi->firmware = firmware;
|
|
platform_set_drvdata(pdev, rpi);
|
|
|
|
- clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, NUM_FW_CLKS),
|
|
+ clk_data = devm_kzalloc(dev, struct_size(clk_data, hws,
|
|
+ RPI_FIRMWARE_NUM_CLK_ID),
|
|
GFP_KERNEL);
|
|
if (!clk_data)
|
|
return -ENOMEM;
|