ARM: rpi: fix reading of the EMMC clock for CONFIG_MMU
Subsystems (2)
PATCH 1/1 ARM: rpi: fix reading of the EMMC clock for CONFIG_MMU
Add explicit flushing to prevent the 50MHz fallback.
--- drivers/mci/mci-bcm2835.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mci/mci-bcm2835.c +6 -1
@@ -28,6 +28,7 @@* Author: Wilhelm Lundgren <[email protected]> */ +#include <asm/mmu.h> #include <common.h> #include <init.h> #include <mci.h>
@@ -471,7 +472,7 @@ int bcm2835_mci_reset(struct mci_host *mci, struct device_d *mci_dev)static u32 bcm2835_mci_get_emmc_clock (struct msg_get_clock_rate *clk_data) {u32 val; -struct bcm2835_mbox_regs *regs = +struct bcm2835_mbox_regs __iomem *regs = (struct bcm2835_mbox_regs *)BCM2835_MBOX_PHYSADDR ;/*Read out old msg*/
@@ -489,6 +490,7 @@ static u32 bcm2835_mci_get_emmc_clock(struct msg_get_clock_rate *clk_data)break ; } val =BCM2835_MBOX_PROP_CHAN + ((u32) &clk_data->hdr); +dma_flush_range ((u32 )clk_data, (u32 )clk_data +sizeof (*clk_data));writel (val, ®s->write);while (true) {
@@ -504,6 +506,9 @@ static u32 bcm2835_mci_get_emmc_clock(struct msg_get_clock_rate *clk_data)if ((val &0x0F ) ==BCM2835_MBOX_PROP_CHAN )break ; } + +dma_inv_range ((u32 )clk_data, (u32 )clk_data +sizeof (*clk_data)); +if ((val & ~0x0F ) == ((u32) &clk_data->hdr))if (clk_data->get_clock_rate.tag_hdr.val_len &BCM2835_MBOX_TAG_VAL_LEN_RESPONSE )
Signature · 7 lines
1.8.3.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Am Dienstag, den 15.10.2013, 19:38 +0200 schrieb Andre Heider:
Quoted 2 lines
Add explicit flushing to prevent the 50MHz fallback.
Uh, this is pretty ugly. We certainly don't want all those explicit invalidates/flushes in the driver code. Isn't it possible to push this into some helper functions, that do the right thing when communicating with the mailboxes?
Quoted 44 lines
Signed-off-by Andre Heider <[email protected]>--- drivers/mci/mci-bcm2835.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/mci/mci-bcm2835.c +6
-1@@ -28,6 +28,7 @@* Author: Wilhelm Lundgren <[email protected]> */ +#include <asm/mmu.h> #include <common.h> #include <init.h> #include <mci.h> @@ -471,7 +472,7 @@ int bcm2835_mci_reset(struct mci_host *mci, struct device_d *mci_dev)static u32 bcm2835_mci_get_emmc_clock (struct msg_get_clock_rate *clk_data) {u32 val; -struct bcm2835_mbox_regs *regs = +struct bcm2835_mbox_regs __iomem *regs = (struct bcm2835_mbox_regs *)BCM2835_MBOX_PHYSADDR ;/*Read out old msg*/ @@ -489,6 +490,7 @@ static u32 bcm2835_mci_get_emmc_clock(struct msg_get_clock_rate *clk_data)break ; } val =BCM2835_MBOX_PROP_CHAN + ((u32) &clk_data->hdr); +dma_flush_range ((u32 )clk_data, (u32 )clk_data +sizeof (*clk_data));writel (val, ®s->write);while (true) {@@ -504,6 +506,9 @@ static u32 bcm2835_mci_get_emmc_clock(struct msg_get_clock_rate *clk_data)if ((val &0x0F ) ==BCM2835_MBOX_PROP_CHAN )break ; } + +dma_inv_range ((u32 )clk_data, (u32 )clk_data +sizeof (*clk_data)); +if ((val & ~0x0F ) == ((u32) &clk_data->hdr))if (clk_data->get_clock_rate.tag_hdr.val_len &BCM2835_MBOX_TAG_VAL_LEN_RESPONSE )
Signature · 10 lines
Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5076 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 7 lines · Lucas Stach
Am Dienstag, den 15.10.2013, 19:38 +0200 schrieb Andre Heider:
Quoted 2 lines
Add explicit flushing to prevent the 50MHz fallback.
Uh, this is pretty ugly. We certainly don't want all those explicit invalidates/flushes in the driver code. Isn't it possible to push this into some helper functions, that do the right thing when communicating with the mailboxes?
Sure, as of now this was just the only mbox user. So I hacked away to prevent regressions under CONFIG_MMU ;)
But I planned to work on exactly that, since we want to use mbox for other things too (like setting up simplefb for the kernel).
Regards,
Andre
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 1 line · Andre Heider
Add explicit flushing to prevent the 50MHz fallback.
Oops, I saw the message but didn't notice I introduced it.
The bcm2835_mci_get_emmc_clock() seems to use some mailbox system to get the clock (from the graphics core?). We should probably convert this into some generic code to access these bcm2835 mailboxes. Maybe U-Boot or the kernel already provide code for it.
Anyway, applied this patch for now.
Sascha
Quoted 54 lines
Signed-off-by Andre Heider <[email protected]>--- drivers/mci/mci-bcm2835.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/mci/mci-bcm2835.c +6
-1@@ -28,6 +28,7 @@* Author: Wilhelm Lundgren <[email protected]> */ +#include <asm/mmu.h> #include <common.h> #include <init.h> #include <mci.h> @@ -471,7 +472,7 @@ int bcm2835_mci_reset(struct mci_host *mci, struct device_d *mci_dev)static u32 bcm2835_mci_get_emmc_clock (struct msg_get_clock_rate *clk_data) {u32 val; -struct bcm2835_mbox_regs *regs = +struct bcm2835_mbox_regs __iomem *regs = (struct bcm2835_mbox_regs *)BCM2835_MBOX_PHYSADDR ;/*Read out old msg*/ @@ -489,6 +490,7 @@ static u32 bcm2835_mci_get_emmc_clock(struct msg_get_clock_rate *clk_data)break ; } val =BCM2835_MBOX_PROP_CHAN + ((u32) &clk_data->hdr); +dma_flush_range ((u32 )clk_data, (u32 )clk_data +sizeof (*clk_data));writel (val, ®s->write);while (true) {@@ -504,6 +506,9 @@ static u32 bcm2835_mci_get_emmc_clock(struct msg_get_clock_rate *clk_data)if ((val &0x0F ) ==BCM2835_MBOX_PROP_CHAN )break ; } + +dma_inv_range ((u32 )clk_data, (u32 )clk_data +sizeof (*clk_data)); +if ((val & ~0x0F ) == ((u32) &clk_data->hdr))if (clk_data->get_clock_rate.tag_hdr.val_len &BCM2835_MBOX_TAG_VAL_LEN_RESPONSE )Signature · 7 lines
1.8.3.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox