summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2015-04-16 12:28:58 -0700
committerEric Anholt <eric@anholt.net>2015-06-23 17:02:40 -0700
commitcae3e5027923ef89362d0ede2b7544334f701b36 (patch)
tree1111541144a015f9082330f871e84288b591c9d3
parentec43ee9ffa7967bd8d3111c539f60ce0c1c9ef4c (diff)
downloadlinux-cae3e5027923ef89362d0ede2b7544334f701b36.tar.gz
drm/vc4: Switch the driver from 2835 to 2708/2709.
-rw-r--r--arch/arm/boot/dts/bcm2708_common.dtsi57
-rw-r--r--drivers/gpu/drm/vc4/Kconfig2
-rw-r--r--drivers/gpu/drm/vc4/vc4_drv.c12
-rw-r--r--drivers/gpu/drm/vc4/vc4_drv.h2
-rw-r--r--drivers/gpu/drm/vc4/vc4_hdmi.c24
-rw-r--r--drivers/gpu/drm/vc4/vc4_v3d.c2
6 files changed, 64 insertions, 35 deletions
diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi
index 8caa234d5300..ccf01a568cb6 100644
--- a/arch/arm/boot/dts/bcm2708_common.dtsi
+++ b/arch/arm/boot/dts/bcm2708_common.dtsi
@@ -154,6 +154,15 @@
status = "disabled";
};
+ i2c2: i2c@7e805000 {
+ compatible = "brcm,bcm2835-i2c";
+ reg = <0x7e805000 0x1000>;
+ interrupts = <2 21>;
+ clocks = <&clk_i2c>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
+
usb: usb@7e980000 {
compatible = "brcm,bcm2708-usb";
reg = <0x7e980000 0x10000>,
@@ -180,6 +189,54 @@
thermal: thermal {
compatible = "brcm,bcm2835-thermal";
};
+
+ v3d: brcm,vc4-v3d@7ec00000 {
+ compatible = "brcm,vc4-v3d";
+ reg = <0x7ec00000 0x1000>;
+ interrupts = <1 10>;
+ };
+
+ hdmi: brcm,vc4-hdmi@7e902000 {
+ compatible = "brcm,vc4-hdmi";
+ reg = <0x7e902000 0x600>,
+ <0x7e808000 0x100>;
+ interrupts = <2 8>, <2 9>;
+ ddc = <&i2c2>;
+ hpd-gpio = <&gpio 46 0>;
+ crtc = <&pv2>;
+ };
+
+ pv0: brcm,vc4-pixelvalve@7e206000 {
+ compatible = "brcm,vc4-pixelvalve";
+ reg = <0x7e206000 0x100>;
+ interrupts = <2 13>; /* pwa2 */
+ };
+
+ pv1: brcm,vc4-pixelvalve@7e207000 {
+ compatible = "brcm,vc4-pixelvalve";
+ reg = <0x7e207000 0x100>;
+ interrupts = <2 14>; /* pwa1 */
+ };
+
+ pv2: brcm,vc4-pixelvalve@7e807000 {
+ compatible = "brcm,vc4-pixelvalve";
+ reg = <0x7e807000 0x100>;
+ interrupts = <2 10>; /* pixelvalve */
+ };
+
+ hvs: brcm,hvs@7e400000 {
+ compatible = "brcm,vc4-hvs";
+ reg = <0x7e400000 0x6000>;
+ };
+
+ vc4: vc4@0x7e4c0000 {
+ compatible = "brcm,vc4";
+
+ gpus = <&v3d>;
+ crtcs = <&pv0>, <&pv1>, <&pv2>;
+ encoders = <&hdmi>;
+ hvss = <&hvs>;
+ };
};
clocks: clocks {
diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig
index 09706c1eeaca..b311ce5291e7 100644
--- a/drivers/gpu/drm/vc4/Kconfig
+++ b/drivers/gpu/drm/vc4/Kconfig
@@ -1,6 +1,6 @@
config DRM_VC4
tristate "Broadcom VC4 Graphics"
- depends on ARCH_BCM2835
+ depends on ARCH_BCM2708 || ARCH_BCM2709
depends on DRM
select DRM_KMS_HELPER
select DRM_KMS_FB_HELPER
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 8d32dca645ad..6521d66a9037 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -50,7 +50,6 @@ vc4_ioremap_regs(struct platform_device *dev, int index)
static int
vc4_drm_load(struct drm_device *dev, unsigned long flags)
{
- struct platform_device *firmware_pdev;
struct vc4_dev *vc4;
int ret;
@@ -58,17 +57,6 @@ vc4_drm_load(struct drm_device *dev, unsigned long flags)
if (!vc4)
return -ENOMEM;
- vc4->firmware_node = of_parse_phandle(dev->dev->of_node, "firmware", 0);
- if (!vc4->firmware_node) {
- DRM_ERROR("Failed to parse firmware node.\n");
- return -EINVAL;
- }
- firmware_pdev = of_find_device_by_node(vc4->firmware_node);
- if (!platform_get_drvdata(firmware_pdev)) {
- DRM_DEBUG("firmware device not probed yet.\n");
- return -EPROBE_DEFER;
- }
-
dev_set_drvdata(dev->dev, dev);
vc4->dev = dev;
dev->dev_private = vc4;
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 9fdddf823114..34ec8503c35c 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -12,8 +12,6 @@
struct vc4_dev {
struct drm_device *dev;
- struct device_node *firmware_node;
-
struct vc4_hdmi *hdmi;
struct vc4_hvs *hvs;
struct vc4_crtc *crtc[3];
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 5529b7bb5503..8c41fdc4ef2e 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -20,7 +20,6 @@
#include "drm_crtc_helper.h"
#include "drm_edid.h"
#include "linux/component.h"
-#include "linux/of_gpio.h"
#include "linux/of_platform.h"
#include "soc/bcm2835/raspberrypi-firmware-property.h"
#include "vc4_drv.h"
@@ -32,7 +31,6 @@ struct vc4_hdmi {
struct i2c_adapter *ddc;
void __iomem *hdmicore_regs;
void __iomem *hd_regs;
- int hpd_gpio;
};
#define HDMI_READ(offset) readl(vc4->hdmi->hdmicore_regs + offset)
#define HDMI_WRITE(offset, val) writel(val, vc4->hdmi->hdmicore_regs + offset)
@@ -145,12 +143,10 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
struct drm_device *dev = connector->dev;
struct vc4_dev *vc4 = to_vc4_dev(dev);
- if (vc4->hdmi->hpd_gpio) {
- if (gpio_get_value(vc4->hdmi->hpd_gpio))
- return connector_status_connected;
- else
- return connector_status_disconnected;
- }
+ /* Disable the HPD detect for now, since it doesn't work on
+ * the downstream kernel.
+ */
+ return connector_status_connected;
if (HDMI_READ(VC4_HDMI_HOTPLUG) & VC4_HDMI_HOTPLUG_CONNECTED)
return connector_status_connected;
@@ -281,7 +277,7 @@ vc4_set_pixel_clock(struct vc4_dev *vc4, u32 clock)
packet[0] = 8; /* Pixel clock. */
packet[1] = clock;
- ret = rpi_firmware_property(vc4->firmware_node,
+ ret = rpi_firmware_property(vc4->dev->dev,
RPI_FIRMWARE_SET_CLOCK_RATE,
&packet, sizeof(packet));
@@ -494,7 +490,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
struct vc4_dev *vc4 = drm->dev_private;
struct vc4_hdmi *hdmi;
struct device_node *ddc_node;
- u32 value;
hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);
if (!hdmi)
@@ -522,15 +517,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
return -EPROBE_DEFER;
}
- /* Only use the GPIO HPD pin if present in the DT, otherwise
- * we'll use the HDMI core's register.
- */
- if (of_find_property(dev->of_node, "hpd-gpio", &value)) {
- hdmi->hpd_gpio = of_get_named_gpio(dev->of_node, "hpd-gpio", 0);
- if (hdmi->hpd_gpio < 0)
- return hdmi->hpd_gpio;
- }
-
vc4->hdmi = hdmi;
return 0;
diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
index 8841d8e97695..2364c4e3248a 100644
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -154,7 +154,7 @@ vc4_v3d_set_power(struct vc4_dev *vc4, bool on)
{
u32 packet = on;
- return rpi_firmware_property(vc4->firmware_node,
+ return rpi_firmware_property(vc4->dev->dev,
RPI_FIRMWARE_SET_ENABLE_QPU,
&packet, sizeof(packet));
}