Skip to content

Commit 1ac954a

Browse files
lategoodbyepopcornmix
authored andcommitted
HACK: clk-bcm2835: Add BCM2838_CLOCK_EMMC2 support
The new BCM2838 supports an additional emmc2 clock. So add a new compatible to register this clock only for BCM2838. Signed-off-by: Stefan Wahren <[email protected]>
1 parent b051adf commit 1ac954a

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

drivers/clk/bcm/clk-bcm2835.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@
124124
#define CM_AVEODIV 0x1bc
125125
#define CM_EMMCCTL 0x1c0
126126
#define CM_EMMCDIV 0x1c4
127+
#define CM_EMMC2CTL 0x1d0
128+
#define CM_EMMC2DIV 0x1d4
127129

128130
/* General bits for the CM_*CTL regs */
129131
# define CM_ENABLE BIT(4)
@@ -2047,6 +2049,15 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
20472049
.frac_bits = 8,
20482050
.tcnt_mux = 39),
20492051

2052+
/* EMMC2 clock (only available for BCM2838) */
2053+
[BCM2838_CLOCK_EMMC2] = REGISTER_PER_CLK(
2054+
.name = "emmc2",
2055+
.ctl_reg = CM_EMMC2CTL,
2056+
.div_reg = CM_EMMC2DIV,
2057+
.int_bits = 4,
2058+
.frac_bits = 8,
2059+
.tcnt_mux = 42),
2060+
20502061
/* General purpose (GPIO) clocks */
20512062
[BCM2835_CLOCK_GP0] = REGISTER_PER_CLK(
20522063
.name = "gp0",
@@ -2276,8 +2287,12 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
22762287

22772288
for (i = 0; i < asize; i++) {
22782289
desc = &clk_desc_array[i];
2279-
if (desc->clk_register && desc->data)
2280-
hws[i] = desc->clk_register(cprman, desc->data);
2290+
if (desc->clk_register && desc->data) {
2291+
if ((i != BCM2838_CLOCK_EMMC2) ||
2292+
of_device_is_compatible(fw_node, "brcm,bcm2838-cprman")) {
2293+
hws[i] = desc->clk_register(cprman, desc->data);
2294+
}
2295+
}
22812296
}
22822297

22832298
ret = bcm2835_mark_sdc_parent_critical(hws[BCM2835_CLOCK_SDRAM]->clk);
@@ -2297,6 +2312,7 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
22972312

22982313
static const struct of_device_id bcm2835_clk_of_match[] = {
22992314
{ .compatible = "brcm,bcm2835-cprman", },
2315+
{ .compatible = "brcm,bcm2838-cprman", },
23002316
{}
23012317
};
23022318
MODULE_DEVICE_TABLE(of, bcm2835_clk_of_match);

include/dt-bindings/clock/bcm2835.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,5 @@
6666
#define BCM2835_CLOCK_DSI1E 48
6767
#define BCM2835_CLOCK_DSI0P 49
6868
#define BCM2835_CLOCK_DSI1P 50
69+
70+
#define BCM2838_CLOCK_EMMC2 51

0 commit comments

Comments
 (0)