arm: rpi: Enable USB, Ethernet, MMC, Video driver model on Raspberry Pi
Subsystems (9)
v6 cover arm: rpi: Enable USB, Ethernet, MMC, Video driver model on Raspberry Pi
Raspberry Pi uses a DWC2 USB controller and a SMSC USB Ethernet adaptor. Driver model support for these is available.
This series does the following:
- Enable CONFIG_DM_ETH and CONFIG_DM_USB on Raspberry Pi
- Convert the MMC driver to driver model
- Convert the video driver to driver model
- Fixes a driver model video bug which accessed beyond the frame buffer
- Fixes start-up of MMC with driver model (e.g. at present it does not support env_fat)
- Clean up a few loose ends
With Ethernet active the device list looks something like this:
U-Boot> dm tree
Class Probed Name
----------------------------------------
root [ + ] root_driver simple_bus [ + ] |-- soc gpio [ + ] | |-- gpio at 7e200000 serial [ + ] | |-- serial at 7e215040 mmc [ + ] | |-- sdhci at 7e300000 blk [ + ] | | `-- sdhci at 7e300000.blk video [ + ] | |-- hdmi at 7e902000 vidconsole0 [ + ] | | `-- hdmi at 7e902000.vidconsole0 usb [ + ] | `-- usb at 7e980000 usb_hub [ + ] | `-- usb_hub usb_hub [ + ] | `-- usb_hub eth [ + ] | `-- smsc95xx_eth simple_bus [ ] `-- clocks
With version 4 a problem was discovered where tftpboot does not correctly read a file on rpi_2 and rpi_3. The cause is unknown but for now this series includes a work-around in the dwc2 driver. See here for details:
https://lists.denx.de/pipermail/u-boot/2017-April/285451.html
Changes in v6:
- Drop changes to dwc2.c now we have http://patchwork.ozlabs.org/patch/746917/
- Rebase to master
Changes in v5:
- Add new patch for smsc95xx to correct free_pkt() implementation
- Rebase to master
Changes in v4:
- Add patches to convert video and MMC to driver model also
- Rebase to master
Changes in v3:
- Drop applied patches from series
- Drop patch to introduce usbethaddr for driver model
Simon Glass (18):
net: smsc95xx: Correct free_pkt() implementation
dm: mmc: Set up the MMC device when controller is probed
dm: video: Correct line clearing code
string: Use memcpy() within memmove() when we can
arm: rpi: Drop the GPIO device addresses
arm: rpi: Drop CONFIG_CONS_INDEX
dm: arm: rpi: Move to driver model for USB
dm: arm: rpi: Use driver model for Ethernet
arm: rpi: Add a file to handle messages
arm: rpi: Add a function to obtain the MMC clock
dm: mmc: rpi: Convert Raspberry Pi to driver model for MMC
dm: arm: rpi: Drop CONFIG_OF_EMBED
video: arm: rpi: Move the video query out of the driver
video: arm: rpi: Move the video settings out of the driver
dm: video: Refactor lcd_simplefb to prepare for driver model
dm: video: Add driver-model support to lcd_simplefb
dm: video: arm: rpi: Convert to use driver model for video
arm: rpi: Add a TODO to move all messages into the msg handler
arch/arm/mach-bcm283x/Makefile | 2 +- arch/arm/mach-bcm283x/include/mach/gpio.h | 5 - arch/arm/mach-bcm283x/include/mach/msg.h | 51 ++++++++++ arch/arm/mach-bcm283x/msg.c | 154 ++++++++++++++++++++++++++++++ board/raspberrypi/rpi/rpi.c | 56 +---------- common/lcd_simplefb.c | 47 +++++++-- configs/rpi_2_defconfig | 6 +- configs/rpi_3_32b_defconfig | 6 +- configs/rpi_3_defconfig | 6 +- configs/rpi_defconfig | 6 +- drivers/mmc/bcm2835_sdhci.c | 81 ++++++++++++---- drivers/mmc/mmc-uclass.c | 12 +++ drivers/usb/eth/smsc95xx.c | 4 +- drivers/video/bcm2835.c | 140 +++++++-------------------- drivers/video/console_normal.c | 3 +- include/configs/rpi.h | 17 +--- lib/string.c | 11 +-- 17 files changed, 384 insertions(+), 223 deletions(-) create mode 100644 arch/arm/mach-bcm283x/include/mach/msg.h create mode 100644 arch/arm/mach-bcm283x/msg.c
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 1/18 net: smsc95xx: Correct free_pkt() implementation
On further review this returns the wrong packet length from the driver. It may not be noticed since protocols will take care of it. Fix it by subtracting the header length from the packet length returned.
---
Changes in v6: None
Changes in v5:
- Add new patch for smsc95xx to correct free_pkt() implementation
Changes in v4: None
Changes in v3: None
drivers/usb/eth/smsc95xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/eth/smsc95xx.c +2 -2
@@ -998,7 +998,7 @@ int smsc95xx_eth_recv(struct udevice *dev, int flags, uchar **packetp) } *packetp = ptr +sizeof (packet_len); -return packet_len; +return packet_len -4 ; err:usb_ether_advance_rxbuf (ueth,-1 );
@@ -1009,7 +1009,7 @@ static int smsc95xx_free_pkt(struct udevice *dev, uchar *packet, int packet_len) {struct smsc95xx_private *priv =dev_get_priv (dev); - packet_len =ALIGN (packet_len,4 ); + packet_len =ALIGN (packet_len +sizeof (u32),4 );usb_ether_advance_rxbuf (&priv->ueth,sizeof (u32) + packet_len);return 0 ;
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 1/18 net: smsc95xx: Correct free_pkt() implementation
Quoted 5 lines · Simon Glass
On further review this returns the wrong packet length from the driver. It may not be noticed since protocols will take care of it. Fix it by subtracting the header length from the packet length returned.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/a92ee9ca/attachment.sig>
PATCH v6 2/18 dm: mmc: Set up the MMC device when controller is probed
In reply to Simon GlassWhen an MMC controller is set up we should probe the device to find out what it is. This includes finding its capacity and reading its partition table.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
drivers/mmc/mmc-uclass.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/mmc/mmc-uclass.c +12 -0
@@ -239,6 +239,15 @@ int mmc_unbind(struct udevice *dev)return 0 ; } +#ifdef CONFIG_BLK +static int mmc_post_probe (struct udevice *dev) +{ +struct mmc *mmc =mmc_get_mmc_dev (dev); + +return mmc_init (mmc); +} +#endif +static int mmc_select_hwpart (struct udevice *bdev,int hwpart) {struct udevice *mmc_dev =dev_get_parent (bdev);
@@ -292,4 +301,7 @@ UCLASS_DRIVER(mmc) = { .name = "mmc", .flags = DM_UC_FLAG_SEQ_ALIAS, .per_device_auto_alloc_size = sizeof(struct mmc_uclass_priv), +#ifdef CONFIG_BLK + .post_probe = mmc_post_probe, +#endif };
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 2/18 dm: mmc: Set up the MMC device when controller is probed
Hi,
Quoted 8 lines · Simon Glass
When an MMC controller is set up we should probe the device to find out what it is. This includes finding its capacity and reading its partition table.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Jaehoon Chung <[email protected]>---
Quoted 7 lines
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: Nonedrivers/mmc/mmc-uclass.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
I think I have a better way of doing this, so I'm withdrawing this patch. I'll send a series with my ideas.
Regards,
Simon
PATCH v6 3/18 dm: video: Correct line clearing code
In reply to Simon GlassAt present we clear many more bytes than we should on 16bpp and 32bpp displays. The number of pixels to clear is currently calculated as the line length (in bytes) multiplied by the number of lines to clear. This is only correct for 8bpp displays.
Correct the calculation to use the number of text columns multiplied by the width of each character multiplied by the number of lines to clear.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
drivers/video/console_normal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/console_normal.c +2 -1
@@ -16,9 +16,10 @@static int console_normal_set_row (struct udevice *dev,uint row,int clr) { +struct vidconsole_priv *vc_priv =dev_get_uclass_priv (dev);struct video_priv *vid_priv =dev_get_uclass_priv (dev->parent);void *line; -int pixels =VIDEO_FONT_HEIGHT * vid_priv->line_length; +int pixels =VIDEO_FONT_HEIGHT * vc_priv->cols *VIDEO_FONT_WIDTH ;int i; line = vid_priv->fb + row *VIDEO_FONT_HEIGHT * vid_priv->line_length;
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 3/18 dm: video: Correct line clearing code
Quoted 10 lines · Simon Glass
At present we clear many more bytes than we should on 16bpp and 32bpp displays. The number of pixels to clear is currently calculated as the line length (in bytes) multiplied by the number of lines to clear. This is only correct for 8bpp displays.
Correct the calculation to use the number of text columns multiplied by the width of each character multiplied by the number of lines to clear.
Signed-off-by Simon Glass <[email protected]>
This has been deferred as another change:
commit 7682736c891d2b6f0cce167f4ecd55d2df0f562f
Author: eric.gao at rock-chips.com <[email protected]> Date: Mon Apr 10 10:02:20 2017 +0800
video: Fix crash when scroll screen
also fixed the problem and has since gone in.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/627f0e73/attachment.sig>
PATCH v6 4/18 string: Use memcpy() within memmove() when we can
In reply to Simon GlassA common use of memmove() can be handled by memcpy(). Also memcpy() includes an optimisation for large sizes: it copies a word at a time. So we can get a speed-up by calling memcpy() to handle our move in this case.
Update memmove() to call memcpy() if the destination is before the source.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
lib/string.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
lib/string.c +2 -9
@@ -511,16 +511,9 @@ void * memmove(void * dest,const void *src,size_t count) {char *tmp, *s; -if (src == dest) -return dest; -if (dest <= src) { - tmp = (char *) dest; - s = (char *) src; -while (count--) - *tmp++ = *s++; - } -else { +memcpy (dest, src, count); + }else { tmp = (char *) dest + count; s = (char *) src + count;while (count--)
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 4/18 string: Use memcpy() within memmove() when we can
Quoted 8 lines · Simon Glass
A common use of
memmove()can be handled bymemcpy(). Alsomemcpy()includes an optimisation for large sizes: it copies a word at a time. So we can get a speed-up by callingmemcpy()to handle our move in this case.Update
memmove()to callmemcpy()if the destination is before the source.Signed-off-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/860b72e8/attachment.sig>
PATCH v6 5/18 arm: rpi: Drop the GPIO device addresses
In reply to Simon GlassWe can rely on the device tree to provide this information.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
arch/arm/mach-bcm283x/include/mach/gpio.h | 5 ----- 1 file changed, 5 deletions(-)
arch/arm/mach-bcm283x/include/mach/gpio.h +0 -5
@@ -9,11 +9,6 @@#ifndef _BCM2835_GPIO_H_#define _BCM2835_GPIO_H_ -#ifndef CONFIG_BCM2835 -#define BCM2835_GPIO_BASE 0x3f200000 -#else -#define BCM2835_GPIO_BASE 0x20200000 -#endif #define BCM2835_GPIO_COUNT 54#define BCM2835_GPIO_FSEL_MASK 0x7
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 5/18 arm: rpi: Drop the GPIO device addresses
Quoted 3 lines · Simon Glass
We can rely on the device tree to provide this information.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/2c56a9d3/attachment.sig>
PATCH v6 6/18 arm: rpi: Drop CONFIG_CONS_INDEX
In reply to Simon GlassThis is not needed now that serial uses driver model.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
include/configs/rpi.h | 1 - 1 file changed, 1 deletion(-)
include/configs/rpi.h +0 -1
@@ -98,7 +98,6 @@#else #define CONFIG_PL01X_SERIAL #endif -#define CONFIG_CONS_INDEX 0/* Console configuration */ #define CONFIG_SYS_CBSIZE 1024
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 6/18 arm: rpi: Drop CONFIG_CONS_INDEX
Quoted 3 lines · Simon Glass
This is not needed now that serial uses driver model.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/37ea0b8a/attachment.sig>
PATCH v6 7/18 dm: arm: rpi: Move to driver model for USB
In reply to Simon GlassStart using driver model for USB on the Raspberry Pi. The dwc2 supports this now so this is just a config change.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
configs/rpi_2_defconfig | 1 + configs/rpi_3_32b_defconfig | 1 + configs/rpi_3_defconfig | 1 + configs/rpi_defconfig | 1 + include/configs/rpi.h | 5 ----- 5 files changed, 4 insertions(+), 5 deletions(-)
configs/rpi_2_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_OF_EMBED=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y CONFIG_USB=y +CONFIG_DM_USB=y CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y CONFIG_CONSOLE_SCROLL_LINES=10
configs/rpi_3_32b_defconfig +1 -0
@@ -19,6 +19,7 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set CONFIG_USB=y +CONFIG_DM_USB=y CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y CONFIG_CONSOLE_SCROLL_LINES=10
configs/rpi_3_defconfig +1 -0
@@ -19,6 +19,7 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set CONFIG_USB=y +CONFIG_DM_USB=y CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y CONFIG_CONSOLE_SCROLL_LINES=10
configs/rpi_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_OF_EMBED=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y CONFIG_USB=y +CONFIG_DM_USB=y CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y CONFIG_CONSOLE_SCROLL_LINES=10
include/configs/rpi.h +0 -5
@@ -80,11 +80,6 @@#ifdef CONFIG_CMD_USB #define CONFIG_USB_DWC2 -#ifndef CONFIG_BCM2835 -#define CONFIG_USB_DWC2_REG_ADDR 0x3f980000 -#else -#define CONFIG_USB_DWC2_REG_ADDR 0x20980000 -#endif #define CONFIG_USB_HOST_ETHER #define CONFIG_USB_ETHER_SMSC95XX #define CONFIG_TFTP_TSIZE
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 7/18 dm: arm: rpi: Move to driver model for USB
Quoted 4 lines · Simon Glass
Start using driver model for USB on the Raspberry Pi. The dwc2 supports this now so this is just a config change.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/e72157fc/attachment.sig>
PATCH v6 8/18 dm: arm: rpi: Use driver model for Ethernet
In reply to Simon GlassEnable CONFIG_DM_ETH so that driver model is used for the USB Ethernet device.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
configs/rpi_2_defconfig | 1 + configs/rpi_3_32b_defconfig | 1 + configs/rpi_3_defconfig | 1 + configs/rpi_defconfig | 1 + 4 files changed, 4 insertions(+)
configs/rpi_2_defconfig +1 -0
@@ -16,6 +16,7 @@ CONFIG_CMD_GPIO=y CONFIG_OF_EMBED=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y +CONFIG_DM_ETH=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y
configs/rpi_3_32b_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_CMD_GPIO=y CONFIG_OF_EMBED=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y +CONFIG_DM_ETH=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set CONFIG_USB=y CONFIG_DM_USB=y
configs/rpi_3_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_CMD_GPIO=y CONFIG_OF_EMBED=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y +CONFIG_DM_ETH=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set CONFIG_USB=y CONFIG_DM_USB=y
configs/rpi_defconfig +1 -0
@@ -16,6 +16,7 @@ CONFIG_CMD_GPIO=y CONFIG_OF_EMBED=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y +CONFIG_DM_ETH=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 8/18 dm: arm: rpi: Use driver model for Ethernet
Quoted 4 lines · Simon Glass
Enable
CONFIG_DM_ETHso that driver model is used for the USB Ethernet device.Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/34a7c3b5/attachment.sig>
PATCH v6 9/18 arm: rpi: Add a file to handle messages
In reply to Simon GlassThe bcm283x chips provide a way for the ARM core to communicate with the graphics processor, which is in charge of many things. This is handled by way of a message prototcol.
At present the code for sending message (and receiving a reply) is spread around U-Boot, primarily in the board file. This means that sending a message from a driver requires duplicating the code.
Create a new message implementation with a function to support powering on a subsystem as a starting point.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
arch/arm/mach-bcm283x/Makefile | 2 +- arch/arm/mach-bcm283x/include/mach/msg.h | 18 +++++++++++++++ arch/arm/mach-bcm283x/msg.c | 39 ++++++++++++++++++++++++++++++++ board/raspberrypi/rpi/rpi.c | 35 +++------------------------- 4 files changed, 61 insertions(+), 33 deletions(-) create mode 100644 arch/arm/mach-bcm283x/include/mach/msg.h create mode 100644 arch/arm/mach-bcm283x/msg.c
arch/arm/mach-bcm283x/Makefile +1 -1
@@ -5,4 +5,4 @@ # obj-$(CONFIG_BCM2835) += lowlevel_init.o -obj-y += init.o reset.o mbox.o phys2bus.o +obj-y += init.o reset.o mbox.o msg.o phys2bus.o
arch/arm/mach-bcm283x/include/mach/msg.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* (C) Copyright 2012,2015 Stephen Warren +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _BCM2835_MSG_H +#define _BCM2835_MSG_H + +/** +* bcm2835_power_on_module() - power on an SoC module +* +* @module: ID of module to power on (BCM2835_MBOX_POWER_DEVID_...) +* @return 0 if OK, -EIO on error +*/ +int bcm2835_power_on_module (u32 module); + +#endif
arch/arm/mach-bcm283x/msg.c new file +39 -0
@@ -0,0 +1,39 @@ +/* +* (C) Copyright 2012 Stephen Warren +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <memalign.h> +#include <asm/arch/mbox.h> + +struct msg_set_power_state { +struct bcm2835_mbox_hdr hdr; +struct bcm2835_mbox_tag_set_power_state set_power_state; +u32 end_tag; +}; + +int bcm2835_power_on_module (u32 module) +{ + ALLOC_CACHE_ALIGN_BUFFER(struct msg_set_power_state, msg_pwr, 1); +int ret; + +BCM2835_MBOX_INIT_HDR (msg_pwr); +BCM2835_MBOX_INIT_TAG (&msg_pwr->set_power_state, +SET_POWER_STATE ); + msg_pwr->set_power_state.body.req.device_id = module; + msg_pwr->set_power_state.body.req.state = +BCM2835_MBOX_SET_POWER_STATE_REQ_ON | +BCM2835_MBOX_SET_POWER_STATE_REQ_WAIT ; + + ret =bcm2835_mbox_call_prop (BCM2835_MBOX_PROP_CHAN , + &msg_pwr->hdr); +if (ret) { +printf ("bcm2835: Could not set module %u power state\n" , + module); +return -EIO ; + } + +return 0 ; +}
board/raspberrypi/rpi/rpi.c +3 -32
@@ -16,6 +16,7 @@#include <mmc.h> #include <asm/gpio.h> #include <asm/arch/mbox.h> +#include <asm/arch/msg.h> #include <asm/arch/sdhci.h> #include <asm/global_data.h> #include <dm/platform_data/serial_bcm283x_mu.h>
@@ -53,12 +54,6 @@ struct msg_get_mac_address {u32 end_tag; }; -struct msg_set_power_state { -struct bcm2835_mbox_hdr hdr; -struct bcm2835_mbox_tag_set_power_state set_power_state; -u32 end_tag; -}; -struct msg_get_clock_rate {struct bcm2835_mbox_hdr hdr;struct bcm2835_mbox_tag_get_clock_rate get_clock_rate;
@@ -365,30 +360,6 @@ int misc_init_r(void)return 0 ; } -static int power_on_module (u32 module) -{ - ALLOC_CACHE_ALIGN_BUFFER(struct msg_set_power_state, msg_pwr, 1); -int ret; - -BCM2835_MBOX_INIT_HDR (msg_pwr); -BCM2835_MBOX_INIT_TAG (&msg_pwr->set_power_state, -SET_POWER_STATE ); - msg_pwr->set_power_state.body.req.device_id = module; - msg_pwr->set_power_state.body.req.state = -BCM2835_MBOX_SET_POWER_STATE_REQ_ON | -BCM2835_MBOX_SET_POWER_STATE_REQ_WAIT ; - - ret =bcm2835_mbox_call_prop (BCM2835_MBOX_PROP_CHAN , - &msg_pwr->hdr); -if (ret) { -printf ("bcm2835: Could not set module %u power state\n" , - module); -return -1 ; - } - -return 0 ; -} -static void get_board_rev (void ) { ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_board_rev, msg, 1);
@@ -492,7 +463,7 @@ int board_init(void) gd->bd->bi_boot_params =0x100 ; -return power_on_module (BCM2835_MBOX_POWER_DEVID_USB_HCD ); +return bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_USB_HCD ); }int board_mmc_init (bd_t *bis)
@@ -500,7 +471,7 @@ int board_mmc_init(bd_t *bis) ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_clock_rate, msg_clk, 1);int ret; -power_on_module (BCM2835_MBOX_POWER_DEVID_SDHCI ); +bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_SDHCI );BCM2835_MBOX_INIT_HDR (msg_clk);BCM2835_MBOX_INIT_TAG (&msg_clk->get_clock_rate,GET_CLOCK_RATE );
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 9/18 arm: rpi: Add a file to handle messages
Quoted 4 lines · Simon Glass
The bcm283x chips provide a way for the ARM core to communicate with the graphics processor, which is in charge of many things. This is handled by way of a message prototcol.
Quoted 8 lines
At present the code for sending message (and receiving a reply) is spread around U-Boot, primarily in the board file. This means that sending a message from a driver requires duplicating the code.
Create a new message implementation with a function to support powering on a subsystem as a starting point.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/7c500169/attachment.sig>
PATCH v6 10/18 arm: rpi: Add a function to obtain the MMC clock
In reply to Simon GlassMove this code into the new message handler file.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
arch/arm/mach-bcm283x/include/mach/msg.h | 7 +++++++ arch/arm/mach-bcm283x/msg.c | 28 ++++++++++++++++++++++++++++ board/raspberrypi/rpi/rpi.c | 16 ++++------------ 3 files changed, 39 insertions(+), 12 deletions(-)
arch/arm/mach-bcm283x/include/mach/msg.h +7 -0
@@ -15,4 +15,11 @@*/ int bcm2835_power_on_module (u32 module); +/** +* bcm2835_get_mmc_clock() - get the frequency of the MMC clock +* +* @return clock frequency, or -ve on error +*/ +int bcm2835_get_mmc_clock (void ); +#endif
arch/arm/mach-bcm283x/msg.c +28 -0
@@ -14,6 +14,12 @@ struct msg_set_power_state {u32 end_tag; }; +struct msg_get_clock_rate { +struct bcm2835_mbox_hdr hdr; +struct bcm2835_mbox_tag_get_clock_rate get_clock_rate; +u32 end_tag; +}; +int bcm2835_power_on_module (u32 module) { ALLOC_CACHE_ALIGN_BUFFER(struct msg_set_power_state, msg_pwr, 1);
@@ -37,3 +43,25 @@ int bcm2835_power_on_module(u32 module)return 0 ; } + +int bcm2835_get_mmc_clock (void ) +{ + ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_clock_rate, msg_clk, 1); +int ret; + + ret =bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_SDHCI ); +if (ret) +return ret; + +BCM2835_MBOX_INIT_HDR (msg_clk); +BCM2835_MBOX_INIT_TAG (&msg_clk->get_clock_rate,GET_CLOCK_RATE ); + msg_clk->get_clock_rate.body.req.clock_id =BCM2835_MBOX_CLOCK_ID_EMMC ; + + ret =bcm2835_mbox_call_prop (BCM2835_MBOX_PROP_CHAN , &msg_clk->hdr); +if (ret) { +printf ("bcm2835: Could not query eMMC clock rate\n" ); +return -EIO ; + } + +return msg_clk->get_clock_rate.body.resp.rate_hz; +}
board/raspberrypi/rpi/rpi.c +4 -12
@@ -468,23 +468,15 @@ int board_init(void)int board_mmc_init (bd_t *bis) { - ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_clock_rate, msg_clk, 1);int ret;bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_SDHCI ); -BCM2835_MBOX_INIT_HDR (msg_clk); -BCM2835_MBOX_INIT_TAG (&msg_clk->get_clock_rate,GET_CLOCK_RATE ); - msg_clk->get_clock_rate.body.req.clock_id =BCM2835_MBOX_CLOCK_ID_EMMC ; + ret =bcm2835_get_mmc_clock (); +if (ret) +return ret; - ret =bcm2835_mbox_call_prop (BCM2835_MBOX_PROP_CHAN , &msg_clk->hdr); -if (ret) { -printf ("bcm2835: Could not query eMMC clock rate\n" ); -return -1 ; - } - -return bcm2835_sdhci_init (BCM2835_SDHCI_BASE , - msg_clk->get_clock_rate.body.resp.rate_hz); +return bcm2835_sdhci_init (BCM2835_SDHCI_BASE , ret); }int ft_board_setup (void *blob,bd_t *bd)
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 10/18 arm: rpi: Add a function to obtain the MMC clock
Quoted 3 lines · Simon Glass
Move this code into the new message handler file.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/82ace841/attachment.sig>
PATCH v6 11/18 dm: mmc: rpi: Convert Raspberry Pi to driver model for MMC
In reply to Simon GlassConvert the bcm2835 SDHCI driver over to support CONFIG_DM_MMC and move all boards over. There is no need to keep the old code since there are no other users.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
board/raspberrypi/rpi/rpi.c | 13 -------- configs/rpi_2_defconfig | 1 + configs/rpi_3_32b_defconfig | 1 + configs/rpi_3_defconfig | 1 + configs/rpi_defconfig | 1 + drivers/mmc/bcm2835_sdhci.c | 81 ++++++++++++++++++++++++++++++++++++--------- 6 files changed, 69 insertions(+), 29 deletions(-)
board/raspberrypi/rpi/rpi.c +0 -13
@@ -466,19 +466,6 @@ int board_init(void)return bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_USB_HCD ); } -int board_mmc_init (bd_t *bis) -{ -int ret; - -bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_SDHCI ); - - ret =bcm2835_get_mmc_clock (); -if (ret) -return ret; - -return bcm2835_sdhci_init (BCM2835_SDHCI_BASE , ret); -} -int ft_board_setup (void *blob,bd_t *bd) {/*
configs/rpi_2_defconfig +1 -0
@@ -14,6 +14,7 @@ CONFIG_CMD_USB=y # CONFIG_CMD_FPGA is not set CONFIG_CMD_GPIO=y CONFIG_OF_EMBED=y +CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y CONFIG_DM_ETH=y
configs/rpi_3_32b_defconfig +1 -0
@@ -15,6 +15,7 @@ CONFIG_CMD_USB=y # CONFIG_CMD_FPGA is not set CONFIG_CMD_GPIO=y CONFIG_OF_EMBED=y +CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y CONFIG_DM_ETH=y
configs/rpi_3_defconfig +1 -0
@@ -15,6 +15,7 @@ CONFIG_CMD_USB=y # CONFIG_CMD_FPGA is not set CONFIG_CMD_GPIO=y CONFIG_OF_EMBED=y +CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y CONFIG_DM_ETH=y
configs/rpi_defconfig +1 -0
@@ -14,6 +14,7 @@ CONFIG_CMD_USB=y # CONFIG_CMD_FPGA is not set CONFIG_CMD_GPIO=y CONFIG_OF_EMBED=y +CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y CONFIG_DM_ETH=y
drivers/mmc/bcm2835_sdhci.c +65 -16
121 lines not on this page · raw message
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 11/18 dm: mmc: rpi: Convert Raspberry Pi to driver model for MMC
Quoted 6 lines · Simon Glass
Convert the bcm2835 SDHCI driver over to support
CONFIG_DM_MMCand move all boards over. There is no need to keep the old code since there are no other users.Reviewed-by Jaehoon Chung <[email protected]>Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/93526b14/attachment.sig>
PATCH v6 12/18 dm: arm: rpi: Drop CONFIG_OF_EMBED
In reply to Simon GlassWe should not use an embedded device tree on a production board. There does not seem to be any reason for it in commit 7670909. So drop this.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
configs/rpi_2_defconfig | 1 - configs/rpi_3_32b_defconfig | 1 - configs/rpi_3_defconfig | 1 - configs/rpi_defconfig | 1 - 4 files changed, 4 deletions(-)
configs/rpi_2_defconfig +0 -1
@@ -13,7 +13,6 @@ CONFIG_CMD_MMC=y CONFIG_CMD_USB=y # CONFIG_CMD_FPGA is not set CONFIG_CMD_GPIO=y -CONFIG_OF_EMBED=y CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y
configs/rpi_3_32b_defconfig +0 -1
@@ -14,7 +14,6 @@ CONFIG_CMD_MMC=y CONFIG_CMD_USB=y # CONFIG_CMD_FPGA is not set CONFIG_CMD_GPIO=y -CONFIG_OF_EMBED=y CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y
configs/rpi_3_defconfig +0 -1
@@ -14,7 +14,6 @@ CONFIG_CMD_MMC=y CONFIG_CMD_USB=y # CONFIG_CMD_FPGA is not set CONFIG_CMD_GPIO=y -CONFIG_OF_EMBED=y CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y
configs/rpi_defconfig +0 -1
@@ -13,7 +13,6 @@ CONFIG_CMD_MMC=y CONFIG_CMD_USB=y # CONFIG_CMD_FPGA is not set CONFIG_CMD_GPIO=y -CONFIG_OF_EMBED=y CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCM2835=y
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 12/18 dm: arm: rpi: Drop CONFIG_OF_EMBED
Quoted 4 lines · Simon Glass
We should not use an embedded device tree on a production board. There does not seem to be any reason for it in commit 7670909. So drop this.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/445c538e/attachment.sig>
PATCH v6 13/18 video: arm: rpi: Move the video query out of the driver
In reply to Simon GlassAdd a function to get the video size to the msg handler and remove it from the video driver.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
arch/arm/mach-bcm283x/include/mach/msg.h | 9 +++++++++ arch/arm/mach-bcm283x/msg.c | 26 ++++++++++++++++++++++++++ drivers/video/bcm2835.c | 20 +++----------------- 3 files changed, 38 insertions(+), 17 deletions(-)
arch/arm/mach-bcm283x/include/mach/msg.h +9 -0
@@ -22,4 +22,13 @@ int bcm2835_power_on_module(u32 module);*/ int bcm2835_get_mmc_clock (void ); +/** +* bcm2835_get_video_size() - get the current display size +* +* @widthp: Returns the width in pixels +* @heightp: Returns the height in pixels +* @return 0 if OK, -ve on error +*/ +int bcm2835_get_video_size (int *widthp,int *heightp); +#endif
arch/arm/mach-bcm283x/msg.c +26 -0
@@ -6,6 +6,7 @@#include <common.h> #include <memalign.h> +#include <phys2bus.h> #include <asm/arch/mbox.h> struct msg_set_power_state {
@@ -20,6 +21,12 @@ struct msg_get_clock_rate {u32 end_tag; }; +struct msg_query { +struct bcm2835_mbox_hdr hdr; +struct bcm2835_mbox_tag_physical_w_h physical_w_h; +u32 end_tag; +}; +int bcm2835_power_on_module (u32 module) { ALLOC_CACHE_ALIGN_BUFFER(struct msg_set_power_state, msg_pwr, 1);
@@ -65,3 +72,22 @@ int bcm2835_get_mmc_clock(void)return msg_clk->get_clock_rate.body.resp.rate_hz; } + +int bcm2835_get_video_size (int *widthp,int *heightp) +{ + ALLOC_CACHE_ALIGN_BUFFER(struct msg_query, msg_query, 1); +int ret; + +BCM2835_MBOX_INIT_HDR (msg_query); +BCM2835_MBOX_INIT_TAG_NO_REQ (&msg_query->physical_w_h, +GET_PHYSICAL_W_H ); + ret =bcm2835_mbox_call_prop (BCM2835_MBOX_PROP_CHAN , &msg_query->hdr); +if (ret) { +printf ("bcm2835: Could not query display resolution\n" ); +return ret; + } + *widthp = msg_query->physical_w_h.body.resp.width; + *heightp = msg_query->physical_w_h.body.resp.height; + +return 0 ; +}
drivers/video/bcm2835.c +3 -17
@@ -9,6 +9,7 @@#include <memalign.h> #include <phys2bus.h> #include <asm/arch/mbox.h> +#include <asm/arch/msg.h> #include <asm/global_data.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -18,12 +19,6 @@ vidinfo_t panel_info;static u32 bcm2835_pitch; -struct msg_query { -struct bcm2835_mbox_hdr hdr; -struct bcm2835_mbox_tag_physical_w_h physical_w_h; -u32 end_tag; -}; -struct msg_setup {struct bcm2835_mbox_hdr hdr;struct bcm2835_mbox_tag_physical_w_h physical_w_h;
@@ -40,27 +35,18 @@ struct msg_setup {void lcd_ctrl_init (void *lcdbase) { - ALLOC_CACHE_ALIGN_BUFFER(struct msg_query, msg_query, 1); ALLOC_CACHE_ALIGN_BUFFER(struct msg_setup, msg_setup, 1);int ret; -u32 w, h; +int w, h;u32 fb_start, fb_end;debug ("bcm2835: Query resolution...\n" ); - -BCM2835_MBOX_INIT_HDR (msg_query); -BCM2835_MBOX_INIT_TAG_NO_REQ (&msg_query->physical_w_h, -GET_PHYSICAL_W_H ); - ret =bcm2835_mbox_call_prop (BCM2835_MBOX_PROP_CHAN , &msg_query->hdr); + ret =bcm2835_get_video_size (&w, &h);if (ret) { -printf ("bcm2835: Could not query display resolution\n" );/* FIXME: How to disable the LCD to prevent errors? hang()? */ return ; } - w = msg_query->physical_w_h.body.resp.width; - h = msg_query->physical_w_h.body.resp.height; -debug ("bcm2835: Setting up display for %d x %d\n" , w, h);BCM2835_MBOX_INIT_HDR (msg_setup);
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 13/18 video: arm: rpi: Move the video query out of the driver
Quoted 5 lines · Simon Glass
Add a function to get the video size to the msg handler and remove it from the video driver.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/81f2a873/attachment.sig>
PATCH v6 14/18 video: arm: rpi: Move the video settings out of the driver
In reply to Simon GlassAdd a function to set the video parameters to the msg handler and remove it from the video driver.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
arch/arm/mach-bcm283x/include/mach/msg.h | 17 ++++++++ arch/arm/mach-bcm283x/msg.c | 61 ++++++++++++++++++++++++++++ drivers/video/bcm2835.c | 68 +++++--------------------------- 3 files changed, 88 insertions(+), 58 deletions(-)
arch/arm/mach-bcm283x/include/mach/msg.h +17 -0
@@ -31,4 +31,21 @@ int bcm2835_get_mmc_clock(void);*/ int bcm2835_get_video_size (int *widthp,int *heightp); +/** +* bcm2835_set_video_params() - set the video parameters +* +* @widthp: Video width to request (returns the actual width selected) +* @heightp: Video height to request (returns the actual height selected) +* @depth_bpp: Requested bit depth +* @pixel_order: Pixel order to use (BCM2835_MBOX_PIXEL_ORDER_...) +* @alpha_mode: Alpha transparency mode to use (BCM2835_MBOX_ALPHA_MODE_...) +* @fb_basep: Returns base address of frame buffer +* @fb_sizep: Returns size of frame buffer +* @pitchp: Returns number of bytes in each frame buffer line +* @return 0 if OK, -ve on error +*/ +int bcm2835_set_video_params (int *widthp,int *heightp,int depth_bpp, +int pixel_order,int alpha_mode,ulong *fb_basep, +ulong *fb_sizep,int *pitchp); +#endif
arch/arm/mach-bcm283x/msg.c +61 -0
70 lines not on this page · raw message
drivers/video/bcm2835.c +10 -58
100 lines not on this page · raw message
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 14/18 video: arm: rpi: Move the video settings out of the driver
Quoted 5 lines · Simon Glass
Add a function to set the video parameters to the msg handler and remove it from the video driver.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/cba2fe24/attachment.sig>
PATCH v6 15/18 dm: video: Refactor lcd_simplefb to prepare for driver model
In reply to Simon GlassAdjust this function so that we can convert it to support CONFIG_DM_VIDEO without a lot of code duplication.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
common/lcd_simplefb.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)
common/lcd_simplefb.c +22 -11
@@ -16,17 +16,28 @@ DECLARE_GLOBAL_DATA_PTR;static int lcd_dt_simplefb_configure_node (void *blob,int off) { -int vl_col =lcd_get_pixel_width (); -int vl_row =lcd_get_pixel_height (); -#if LCD_BPP ==LCD_COLOR16 -return fdt_setup_simplefb_node (blob, off, gd->fb_base, vl_col, vl_row, - vl_col *2 ,"r5g6b5" ); -#elif LCD_BPP ==LCD_COLOR32 -return fdt_setup_simplefb_node (blob, off, gd->fb_base, vl_col, vl_row, - vl_col *4 ,"a8r8g8b8" ); -#else -return -1 ; -#endif +int xsize, ysize; +int bpix;/* log2 of bits per pixel */ +const char *name; +ulong fb_base; + + xsize =lcd_get_pixel_width (); + ysize =lcd_get_pixel_height (); + bpix =LCD_BPP ; + fb_base = gd->fb_base; +switch (bpix) { +case 4 :/* VIDEO_BPP16 */ + name ="r5g6b5" ; +break ; +case 5 :/* VIDEO_BPP32 */ + name ="a8r8g8b8" ; +break ; +default : +return -EINVAL ; + } + +return fdt_setup_simplefb_node (blob, off, fb_base, xsize, ysize, + xsize * (1 << bpix) /8 , name); }int lcd_dt_simplefb_add_node (void *blob)
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 15/18 dm: video: Refactor lcd_simplefb to prepare for driver model
Quoted 5 lines · Simon Glass
Adjust this function so that we can convert it to support
CONFIG_DM_VIDEOwithout a lot of code duplication.Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/a73d49c6/attachment.sig>
PATCH v6 16/18 dm: video: Add driver-model support to lcd_simplefb
In reply to Simon GlassAllow this to work with CONFIG_DM_VIDEO enabled.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
common/lcd_simplefb.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
common/lcd_simplefb.c +18 -0
@@ -8,9 +8,11 @@*/ #include <common.h> +#include <dm.h> #include <lcd.h> #include <fdt_support.h> #include <libfdt.h> +#include <video.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -20,11 +22,27 @@ static int lcd_dt_simplefb_configure_node(void *blob, int off)int bpix;/* log2 of bits per pixel */ const char *name;ulong fb_base; +#ifdef CONFIG_DM_VIDEO +struct video_uc_platdata *plat; +struct video_priv *uc_priv; +struct udevice *dev; +int ret; + ret =uclass_first_device_err (UCLASS_VIDEO , &dev); +if (ret) +return ret; + uc_priv =dev_get_uclass_priv (dev); + plat =dev_get_uclass_platdata (dev); + xsize = uc_priv->xsize; + ysize = uc_priv->ysize; + bpix = uc_priv->bpix; + fb_base = plat->base; +#else xsize =lcd_get_pixel_width (); ysize =lcd_get_pixel_height (); bpix =LCD_BPP ; fb_base = gd->fb_base; +#endif switch (bpix) {case 4 :/* VIDEO_BPP16 */ name ="r5g6b5" ;
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 16/18 dm: video: Add driver-model support to lcd_simplefb
Quoted 4 lines · Simon Glass
Allow this to work with
CONFIG_DM_VIDEOenabled.Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/ca225e93/attachment.sig>
PATCH v6 17/18 dm: video: arm: rpi: Convert to use driver model for video
In reply to Simon GlassAdjust the video driver to work with driver model and move over existing baords. There is no need to keep the old code.
We can also drop setting of CONFIG_FB_ADDR since driver model doesn't have this problem.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
configs/rpi_2_defconfig | 2 +- configs/rpi_3_32b_defconfig | 2 +- configs/rpi_3_defconfig | 2 +- configs/rpi_defconfig | 2 +- drivers/video/bcm2835.c | 62 ++++++++++++++++++++------------------------- include/configs/rpi.h | 11 ++------ 6 files changed, 34 insertions(+), 47 deletions(-)
configs/rpi_2_defconfig +1 -1
@@ -21,6 +21,6 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y +CONFIG_DM_VIDEO=y CONFIG_CONSOLE_SCROLL_LINES=10 -CONFIG_LCD=y CONFIG_PHYS_TO_BUS=y
configs/rpi_3_32b_defconfig +1 -1
@@ -23,6 +23,6 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y +CONFIG_DM_VIDEO=y CONFIG_CONSOLE_SCROLL_LINES=10 -CONFIG_LCD=y CONFIG_PHYS_TO_BUS=y
configs/rpi_3_defconfig +1 -1
@@ -23,6 +23,6 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y +CONFIG_DM_VIDEO=y CONFIG_CONSOLE_SCROLL_LINES=10 -CONFIG_LCD=y CONFIG_PHYS_TO_BUS=y
configs/rpi_defconfig +1 -1
@@ -21,6 +21,6 @@ CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y +CONFIG_DM_VIDEO=y CONFIG_CONSOLE_SCROLL_LINES=10 -CONFIG_LCD=y CONFIG_PHYS_TO_BUS=y
drivers/video/bcm2835.c +28 -34
90 lines not on this page · raw message
include/configs/rpi.h +2 -9
@@ -68,13 +68,6 @@#define CONFIG_BCM2835_GPIO /* LCD */ #define CONFIG_LCD_DT_SIMPLEFB -#define LCD_BPP LCD_COLOR32 -/* -* Prevent allocation of RAM for FB; the real FB address is queried -* dynamically from the VideoCore co-processor, and comes from RAM -* not owned by the ARM CPU. -*/ -#define CONFIG_FB_ADDR 0#define CONFIG_VIDEO_BCM2835 #define CONFIG_SYS_WHITE_ON_BLACK
@@ -125,8 +118,8 @@#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG #define ENV_DEVICE_SETTINGS \ "stdin=serial,usbkbd\0" \ - "stdout=serial,lcd\0" \ - "stderr=serial,lcd\0" + "stdout=serial,vidconsole\0" \ + "stderr=serial,vidconsole\0"/* * Memory layout for where various images get loaded by boot scripts:
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 17/18 dm: video: arm: rpi: Convert to use driver model for video
Quoted 8 lines · Simon Glass
Adjust the video driver to work with driver model and move over existing baords. There is no need to keep the old code.
We can also drop setting of
CONFIG_FB_ADDRsince driver model doesn't have this problem.Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/b85bbcbf/attachment.sig>
PATCH v6 18/18 arm: rpi: Add a TODO to move all messages into the msg handler
In reply to Simon GlassThe board code should all move into msg.c for consistency. Add a TODO for this.
---
Changes in v6:
- Drop changes to dwc2.c now we have http://patchwork.ozlabs.org/patch/746917/
- Rebase to master
Changes in v5:
- Rebase to master
Changes in v4:
- Add patches to convert video and MMC to driver model also
- Rebase to master
Changes in v3:
- Drop applied patches from series
- Drop patch to introduce usbethaddr for driver model
board/raspberrypi/rpi/rpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/raspberrypi/rpi/rpi.c +1 -1
@@ -29,7 +29,7 @@ DECLARE_GLOBAL_DATA_PTR;/* From lowlevel_init.S */ extern unsigned long fw_dtb_pointer; - +/* TODO(sjg at chromium.org): Move these to the msg.c file */ struct msg_get_arm_mem {struct bcm2835_mbox_hdr hdr;struct bcm2835_mbox_tag_get_arm_mem get_arm_mem;
Signature · 1 line
2.12.2.715.g7642488e1d-goog
PATCH v6 18/18 arm: rpi: Add a TODO to move all messages into the msg handler
Quoted 4 lines · Simon Glass
The board code should all move into
msg.cfor consistency. Add a TODO for this.Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170510/d096e6b9/attachment.sig>