diff options
Diffstat (limited to 'arch/arm/boards/raspberry-pi/rpi-common.c')
-rw-r--r-- | arch/arm/boards/raspberry-pi/rpi-common.c | 69 |
1 files changed, 56 insertions, 13 deletions
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c index b2febec991..b5d16a15ca 100644 --- a/arch/arm/boards/raspberry-pi/rpi-common.c +++ b/arch/arm/boards/raspberry-pi/rpi-common.c @@ -73,7 +73,7 @@ static int rpi_get_arm_mem(u32 *size) return 0; } -static struct clk *rpi_register_firmare_clock(u32 clock_id, const char *name) +static struct clk *rpi_register_firmware_clock(u32 clock_id, const char *name) { BCM2835_MBOX_STACK_ALIGN(struct msg_get_clock_rate, msg); int ret; @@ -121,7 +121,7 @@ struct gpio_led rpi_leds[] = { }, }; -void rpi_add_led(void) +static void rpi_add_led(void) { int i; struct gpio_led *l; @@ -138,14 +138,14 @@ void rpi_add_led(void) led_set_trigger(LED_TRIGGER_HEARTBEAT, &l->led); } -void rpi_b_init(void) +static void rpi_b_init(void) { rpi_leds[0].gpio = 16; rpi_leds[0].active_low = 1; rpi_set_usbethaddr(); } -void rpi_b_plus_init(void) +static void rpi_b_plus_init(void) { rpi_leds[0].gpio = 47; rpi_leds[1].gpio = 35; @@ -166,17 +166,30 @@ const struct rpi_model rpi_models_old_scheme[] = { RPI_MODEL(BCM2835_BOARD_REV_B_REV2_d, "Model B rev2", rpi_b_init), RPI_MODEL(BCM2835_BOARD_REV_B_REV2_e, "Model B rev2", rpi_b_init), RPI_MODEL(BCM2835_BOARD_REV_B_REV2_f, "Model B rev2", rpi_b_init), - RPI_MODEL(BCM2835_BOARD_REV_B_PLUS, "Model B+", rpi_b_plus_init), - RPI_MODEL(BCM2835_BOARD_REV_CM, "Compute Module", NULL), - RPI_MODEL(BCM2835_BOARD_REV_A_PLUS, "Model A+", NULL), + RPI_MODEL(BCM2835_BOARD_REV_B_PLUS_10, "Model B+", rpi_b_plus_init), + RPI_MODEL(BCM2835_BOARD_REV_CM_11, "Compute Module", NULL), + RPI_MODEL(BCM2835_BOARD_REV_A_PLUS_12, "Model A+", NULL), + RPI_MODEL(BCM2835_BOARD_REV_B_PLUS_13, "Model B+", rpi_b_plus_init), + RPI_MODEL(BCM2835_BOARD_REV_CM_14, "Compute Module", NULL), + RPI_MODEL(BCM2835_BOARD_REV_A_PLUS_15, "Model A+", NULL), }; const struct rpi_model rpi_models_new_scheme[] = { - RPI_MODEL(0, "Unknown model", NULL), - RPI_MODEL(BCM2836_BOARD_REV_2_B, "2 Model B", rpi_b_plus_init), - RPI_MODEL(BCM2837_BOARD_REV_3_B, "3 Model B", rpi_b_plus_init), - RPI_MODEL(BCM2835_BOARD_REV_ZERO, "Zero", rpi_b_plus_init), - RPI_MODEL(BCM2835_BOARD_REV_ZERO_W, "Zero W", rpi_b_plus_init), + RPI_MODEL(BCM2835_BOARD_REV_A, "Model A", NULL ), + RPI_MODEL(BCM2835_BOARD_REV_B, "Model B", rpi_b_init ), + RPI_MODEL(BCM2835_BOARD_REV_A_PLUS, "Model A+", NULL ), + RPI_MODEL(BCM2835_BOARD_REV_B_PLUS, "Model B+", rpi_b_plus_init ), + RPI_MODEL(BCM2836_BOARD_REV_2_B, "Model 2B", rpi_b_plus_init), + RPI_MODEL(BCM283x_BOARD_REV_Alpha, "Alpha", NULL), + RPI_MODEL(BCM2835_BOARD_REV_CM1, "Compute Module", NULL ), + RPI_MODEL(0x7, "Unknown model", NULL), + RPI_MODEL(BCM2837_BOARD_REV_3_B, "Model 3B", rpi_b_init ), + RPI_MODEL(BCM2835_BOARD_REV_ZERO, "Zero", rpi_b_plus_init), + RPI_MODEL(BCM2837_BOARD_REV_CM3, "Compute Module 3", NULL ), + RPI_MODEL(0xb, "Unknown model", NULL), + RPI_MODEL(BCM2835_BOARD_REV_ZERO_W, "Zero W", rpi_b_plus_init), + RPI_MODEL(BCM2837B0_BOARD_REV_3B_PLUS, "Model 3 B+", rpi_b_plus_init ), + RPI_MODEL(BCM2837B0_BOARD_REV_3A_PLUS, "Nodel 3 A+", rpi_b_plus_init), }; static int rpi_board_rev = 0; @@ -289,7 +302,7 @@ static int rpi_clock_init(void) { struct clk *clk; - clk = rpi_register_firmare_clock(BCM2835_MBOX_CLOCK_ID_EMMC, + clk = rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC, "bcm2835_mci0"); if (IS_ERR(clk)) return PTR_ERR(clk); @@ -301,6 +314,36 @@ static int rpi_clock_init(void) } postconsole_initcall(rpi_clock_init); +#define BCM2835_PL011_BASE 0x20201000 +#define BCM2836_PL011_BASE 0x3f201000 +#define BCM2836_MINIUART_BASE 0x3f215040 + +static int rpi_console_clock_init(void) +{ + struct clk *clk; + + clk = clk_fixed("apb_pclk", 0); + clk_register_clkdev(clk, "apb_pclk", NULL); + + clk = clk_fixed("uart0-pl0110", 3 * 1000 * 1000); + clk_register_clkdev(clk, NULL, "uart0-pl0110"); + clkdev_add_physbase(clk, BCM2835_PL011_BASE, NULL); + clkdev_add_physbase(clk, BCM2836_PL011_BASE, NULL); + + clk = rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_CORE, + "uart1-8250"); + if (IS_ERR(clk)) + return PTR_ERR(clk); + + clkdev_add_physbase(clk, BCM2836_MINIUART_BASE, NULL); + + clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000); + clk_register_clkdev(clk, NULL, "bcm2835-cs"); + + return 0; +} +postcore_initcall(rpi_console_clock_init); + static int rpi_env_init(void) { struct stat s; |